For review: PEP 308 - If-then-else expression
Hans Nowak
wurmy at earthlink.net
Fri Feb 7 18:00:48 EST 2003
Guido van Rossum wrote:
> The proposed syntax is as follows:
>
> <expression1> if <condition> else <expression2
-1. This just "feels" wrong. First you have the first option, then the
condition, then the second option.
> Examples of how this works out:
>
> x if C else y if D else z <==> x if C else (y if D else z)
> x or y if C else z <==> (x or y) if C else z
> x if C else y or z <==> x if C else (y or z)
> lambda: x if C else y <==> lambda: (x if C else y)
> x if C else lambda: y <==> SyntaxError
> x if C else y, z <==> (x if C else y), z
> x, y if C else z <==> x, (y if C else z)
None of these seem especially readable to me. Quite the opposite.
I think the drawbacks outweigh the benefits. Let's not add this.
--
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.awaretek.com/nowak/kaa.html
Soon: http://zephyrfalcon.org/
More information about the Python-list
mailing list