A Suggestion for Python Colon Syntax

D-Man dsh8290 at rit.edu
Thu Dec 21 14:26:36 EST 2000

On Thu, Dec 21, 2000 at 05:43:29PM +0000, William Djaja Tjokroaminata wrote:
> Fredrik Lundh <fredrik at effbot.org> wrote:
> : "William Djaja Tjokroaminata" wrote:
> :> However, a lot of time when I ran my Python program, I got syntax
> :> error, because I forgot to put colon (:) after my if (or for, etc.) clause.
> :> My question is, is the colon really necessary, syntactically, in Python?
> : Short answer:  The colon isn't there for the computer, it's
> : there for human readers.  Just like the colons in your post:
> Well, the colons in my post is because I am writing in English.  But
> Python does not have semicolon etc, just to make it "pretty", but they do

Umm, actually you can put a semicolon at the end of each line (or only
some lines) and it will behave like the semicolon in C/C++/Java/Perl.

It is really useful (needed) if you wanted to write 2 statements on 1
line.  I don't know why that would be needed, but . . . 


More information about the Python-list mailing list