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

Andrew Koenig ark at research.att.com
Sat Feb 8 16:21:32 CET 2003


>> Most of the people opposed to PEP 308 are giving purely subjective
>> reasons, disliking the whole idea so much that not only do they not
>> want to use it, but they want to prevent other people from doing so as
>> well.

holger> Let me guess which side you lean on :-)

I've already gone public:  I'm +0.8.  I like the overall idea, but
have slight misgivings about the infix "if" .

holger> Actually, in my book people gave quite some good reasons 
holger> for opposing the PEP:

holger>     a) it reads ugly especially in non-assignment statements

Subjective.

holger>     b) it reuses a keyword which formerly was a clean indicator
holger>        of a statement

Subjective, especially when you realize that "if" is already thus
reused in list comprehensions.

holger>     c) you can't read it either LtR or RtL 

Agreed -- that's why I'm +0.8 instead of +1.0.

holger>     d) there are often better ways than doing the C-ish
holger>        'x ? y : z' 

Agreed, but that's not an argument against PEP 308 unless you
change "often" to "always".
    
holger>     e) adds to the stuff you have to learn if you read others code

Agreed, but the importance of that is subjective.

holger>     f) is not an important enough use case to warrant new syntax

Subjective.

But what's not subjective is that several people have made statements
of the form ``I don't need it, because I can write X instead'' and
then proceeded to give alternatives that were just plain broken.





More information about the Python-list mailing list