comprehensions was Re: Switch statements again

Tim Peters tim.one at comcast.net
Mon Jan 20 05:46:43 CET 2003


[Erik Max Francis, on
    (f() and [g()] or [h()])[0]
]

> Well, I hope that in "real life" people aren't really doing this
> commonly.

I don't think commonly, no, just sometimes.  When it's someone I know, I
shoot them.

> The point of wanting a conditional operator (which I would gladly
> welcome in Python, by the way) is readability; this utterly destroys
> that.  `p and x or y' (when x is known not to be false) is barely
> tolerable, but even that is seriously pushing it.

The prospects for a conditional operator are dim.  Guido was interested
enough to implement it in late 2001, but eventually rejected his own patch:

    http://www.python.org/sf/471421






More information about the Python-list mailing list