Why the colon?

Carel Fellinger carel.fellinger at iae.nl
Fri Jun 28 22:36:23 EDT 2002

On Fri, Jun 28, 2002 at 07:33:31PM -0400, Erv Young wrote:

...coming from C++ to Python in a mere four days

Welcome here, you sure did the right thing:)

> where I have added line numbers for the sake of the discussion.  I 
> understand the colons in the middle of lines 4, 5, and 7 as statement 
> separators.  Makes perfect sense.
> Then what am I to make of the colons at the end of lines 1 and 
> 2?  "Yoo-hoo, interpreter!  I'm about to start indenting now!"  Hmmm....

You're quit right, the interpreter doesn't need those colons, but user
studies for Python's predecessor ABC indicated that we humans do (or
atleast prefer, on average that is:).  So it's there for the most
Pythonic of all Pythonic virtues: readability.

groetjes, carel

More information about the Python-list mailing list