A TYPICAL NEWBIE MISTAKE?
David Porter
jcm at bigskytel.com
Sun May 14 23:16:38 EDT 2000
* Courageous <jkraska1 at san.rr.com>:
>
> I miss the colons all the time, too (as Mr. Pinard so
> readily pointed out.... ha). Which brings me to the topic.
> Sometimes colons seem syntactically unnecessary. For example:
>
> if <condition>:
> statement
> else:
> statement
>
> Really, else doesn't need a colon, as far as I can tell
> (I can see the need for the if, supposing you wan to
> have the statement on the same line).
>
> Doesn't seem like "def" does, either.
When using python-mode in Emacs (or jed), the colon facilitates
auto-indention. Also, if you forget the colon, the next line will not be
indented, so you will catch your mistake.
david.
More information about the Python-list
mailing list