[Python-Dev] What is the ":" for in python?

Barry Scott barry at barrys-emacs.org
Fri Feb 27 14:31:44 EST 2004


I was asked why python required a ":" in its syntax and then saw
Pete Shinners query on changing the parser to treat "def" to ":" as a unit.

What is the purpose of the ":"?

Why doesn't the parser work as Pete suggests already?
Of course the same rules should be true of "if" and ":", "while" and ":"

I've always wanted to be able to write:

if x > 10
and x < 20:
     do_in_range()

rather then

if( x > 10
and x < 20 ):
     do_in_range()

	Barry





More information about the Python-Dev mailing list