Anybody working on a PEP308 summary?
giles_brown at hotmail.com
Sun Feb 9 12:29:12 CET 2003
Isn't part of the purpose of a PEP to discuss the motivation for the
It is my opinion that this PEP needs a better section on the
clear and objective list of the current means of achieving the same
Technique number 1:
x = condition and expr1 or expr2
Which as we all now know (I guess?) fails in case of bool(expr1) being
Technique number 2:
x = expr1
x = expr2
Which is three extra lines and suffers from the possibility of
a bug through mis-typing x.
I believe the points in this post (so far) are objective arguments for
the PEP. I also believe that the PEP should describe these
motivations. Any other
relatively objective motifications should also be included.
Warning: from here on in is my opinion (so I'm happy for you to ignore
Technique number 1 is a hack. I'm not saying I don't use it, but it
is a hack.
Technique number 2 is clearly not. I'm not swayed at all by the saving
three lines argument. I do have some sympathy for the bug through
mis-typing x argument,
but this is outweight by my lack of sympathy for what looks like a VI
accident. The damage to readability of the proposed syntax does not
outweigh the risk of misnaming the variable.
Note I am also of the opinion that list comprehensions look like a VI
accident, but as Aahz mention are a case of practicality winning out.
also have the advantage of looking like an expression because they are
surrounded by .
More information about the Python-list