PEP308: Yet another syntax proposal
James J. Besemer
jb at cascade-sys.com
Mon Feb 10 18:09:58 EST 2003
Aahz wrote:
> That's still not addressing my point: how often is short-circuit
> evaluation needed?
This is pure rhetoric. It's impossible to answer.
Otherwise, tell us what is is the "correct" answer? 10% of the time? 1%?
0.1%? There is no correct answer.
How often are list comprehensions needed? Booleans needed?
Python already wisely recognizes the need for short-circuit within
expressions. But and/or is not powerful enough.
> That's the *only* reason to consider conditional
> expressions rather than a new builtin conditional function.
Not true, as I and others have explained at length elsewhere. Readability
and maintainability are SERVED by factoring out common sub-expressions from
the more verbose forms:
if condition1:
if condition2
targetVar1 = result1
else:
targetVarl = result2 # hidden BUG!!
else:
targetVar1 = result3
--jb
--
James J. Besemer 503-280-0838 voice
2727 NE Skidmore St. 503-280-0375 fax
Portland, Oregon 97211-6557 mailto:jb at cascade-sys.com
http://cascade-sys.com
More information about the Python-list
mailing list