The use of :
Timo Virkkala
a at a.invalid
Sat Nov 27 00:48:15 EST 2004
Chang LI wrote:
> Paul Robson <autismuk at autismuk.muralichucks.freeserve.co.uk> wrote in message news:<pan.2004.11.26.08.33.40.219098 at autismuk.muralichucks.freeserve.co.uk>...
> So the : is similar to "begin"
Correct
> and the last space line is similar to "end", right?
Nope. You don't need a space line (you mean an empty line by that, right?),
you can just outdent one level and continue without any empty lines
(although in the interactive interpreter you need the empty line to end the
block on the first indentation level). So you could do:
i = 5
while i > 0:
print i
i = i-1
print "That's it"
> How about
> while i > 0 :
> print i
> i = i-1
Works just fine. Other than the indentation, spacing is pretty much
irrelevant in Python.
--
Timo Virkkala
More information about the Python-list
mailing list