I was reading that Python does all it's "code blocks" by indentation, rather than with curly braces. Is that right? So functions, if's and stuff like that all appear without surrounding their block with curly braces?
Yes.
if True:
#dosomething
else:
#dosomething else
#continue on with whatever you were doing
Basically, wherever you would've had an opening curly brace, use a colon instead. Unindent to close the region. It doesn't take long for it to feel completely natural.
Yup :)
And there's (usually) a difference between 4 spaces and a tab, so make sure you standardize the usage ..
Yes. Curly braces are not used. Instead, you use the : symbol to introduce new blocks, like so:
if True:
DoSomething()
SomethingElse()
else:
Something()
Yup. However, you define dictionaries in Python using curly braces:
dict = {
'key': 'value',
}
Ahhhhhh.
if foo: #{
print "it's true"
#}
else: #{
print "it's false!"
#}
(Obviously, this is a joke.)
You can try to add support for braces using a future import statement, but it's not yet supported, so you'll get a syntax error:
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
As others have mentioned, you are correct, no curly braces in Python. Also, you do not have no end or endif or endfor or anything like that (as in pascal or ruby). All code blocks are indentation based.