Vote on PEP 308: Ternary Operator
Dennis Reinhardt
DennisR at dair.com
Sun Mar 2 16:30:03 EST 2003
> > Here's how mine looks:
> Here's mine:
and mine:
Q reject NONE
Q reject NONE
Q reject NONE
Dennis Reinhardt
n/a
n/a
n/a
n/a
n/a
------
308 represents too much cruft. Most examples look good as one-liners with
short names. They do not look so good with longer names. Here is an
example:
z_of_useful_length = 1.0 + (if abs(z_of_useful_length) < .0001: 0 else:
z_of_useful_length)
The above long-name can be expressed in current Python in nearly the same
number of characters as
if abs(z_of_useful_length) < .0001:
z_of_useful_length = 1.0
else:
z_of_useful_length += 1.0
... much more readable.
--
Dennis Reinhardt
http://www.spamai.com
More information about the Python-list
mailing list