[Python-ideas] ('blue', 'red', 'orange' if something, 'green')

Stephen J. Turnbull stephen at xemacs.org
Sat Apr 23 02:32:53 CEST 2011


Sturla Molden writes:

 > I like this interpretation:

You mean "spelling", right?

 > a = 'orange' if cond else pass
 > 
 > (1, 2, 3, pass, 4) == (1,2,3,4)
 > 
 > pass,a,b = a,b

That's the only syntax proposed so far I like at all, but I still
can't imagine a common need for it that isn't served well enough by
the "tuple(comprehension)" spelling.  Maybe the OP (or somebody) can
expand a little on the use case for those of us lacking sufficient
imagination?



More information about the Python-ideas mailing list