For review: PEP 308 - If-then-else expression

Martin Maney maney at pobox.com
Sat Feb 8 22:31:35 EST 2003


Aahz <aahz at pythoncraft.com> wrote:
> You've put your finger on the reason I feel a stronger negative reaction
> to this than the listcomps.  It seems rare to me that someone tries to
> directly transpose a for loop into a listcomp or vice-versa, but I think
> that'll be much more common with this.

That proves not to be the case, IME.  Over a couple decades writing in
languages with the ternary operator, I have found that conversions are
as rare as you imagine for-loop to list-comprehension rewrites to be.
In the long run, that is.  In the short run I wouldn't be surprised to
see a considerable amount of rewriting, just as I rewrote quite a few
for loops into list comprehensions as I was getting to know the latter. 
Of course there will be mistakes made during any such process: that's
learning taking place.  <wink>


Since I've just now discovered the reason there's been so much traffic
here today, I'll say only that I think Andrew's +0.8 is about right.  I
may increase that after I've had the time to see how it looks in actual
code - I'm pretty sure I know where to find some recent code for which
I was wishing for a ternary op.




More information about the Python-list mailing list