anything new on the ternary operator?

Tor torh at operamail.com
Tue Jul 8 10:30:42 EDT 2003


(if C: x else: z)

Was this the winning syntax?  I think I saw it somewhere without the
parentheses, in something written by GvR.  This syntax would have been great
without the parentheses.  A bit messy with them, especially when they really
don't add any readability, like this
return if C1: x elif C2: y else: z

Why are the parentheses neccessary (and are they really)?






More information about the Python-list mailing list