Proposed PEP for a Conditional Expression
aleax at aleax.it
Wed Sep 12 17:09:26 CEST 2001
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
news:slrn9purii.765.qrczak at qrnik.zagroda...
> Wed, 12 Sep 2001 13:56:09 +0200, Alex Martelli <aleax at aleax.it> pisze:
> > I think the proposed conditional operator would be just about at
> > the threshold (I wouldn't particularly care either way if it got in
> > or stayed out) EXCEPT for the risk that it may in fact encourage
> > people to write more lambda's rather than named local functions,
> > which I see as a substantial minus.
> If we prefer list comprehensions to for loops with appends,
> in this case it encourages in the right direction.
Good point! Yes, a conditional operator might be of some
help in writing a list comprehension in certain cases. I
can't think, offhand, of a real-life example where I felt
that need, but theoretical examples are easy to construct.
More information about the Python-list