Quote:
|
If I wanted a block of code within my if statement to be executed... the indentations MUST be there. Correct? Would it be wrong to enclose the block in { }?
|
Yeah, precisely as Big K said. The colons are only part of the syntax because the creators of Python noticed that it really does add to readability, and gives writers of auto-indenters an easier time.
The amount of whitespace you use is up to you, the interpreter is smart enough to latch on to the fact you're using two spaces for your blocks, or a tab character, etc. The Python style guide, however, recommends you use four spaces (and also that you put spaces after each argument to a function, except the last argument :p)