[Python-ideas] Making colons optional?

Stephen J. Turnbull stephen at xemacs.org
Fri Feb 6 05:38:46 CET 2009

Scott Dial writes:
 > Christian Heimes wrote:
 > >    def method(self, some, very, long, method,
 > >               going, over, lots,
 > >               and, lots,
 > >               and, lots, of, lines):
 > >        pass
 > > 
 > This example line-continues via parentheses, so why isn't the
 > right-paren enough?

My eyes are going; I no longer can see how many open parens are there
without moving focus.  The colon is a local indicator that allows me
to avoid backtracking.

 > >     if (some() and some_other() or some_more(complex=(True,))
 > >         and a_final_call(egg=(1,2,3))):
 > >         do_something()
 > This example uses the same mechanism as above.

Except that Python syntax allows you to omit one level of parentheses
and still continue across lines, which you couldn't do without the
colon.  In this example I probably couldn't count the parentheses
correctly even if I could see them all without moving eye focus.

I love Lisp, but I'm also very glad that Python is not Lisp.

More information about the Python-ideas mailing list