PEP-308 a "simplicity-first" alternative
mwilson at the-wire.com
Wed Feb 12 17:36:11 CET 2003
In article <yVi2a.21949$yn1.1390704 at twister.austin.rr.com>,
"Paul Paterson" <hamonlypaulpaterson at houston.rr.com> wrote:
>I still like the minimalism of,
>x or y if C
>val = sqrt(x) or "imaginary" if x<0
[ ... ]
I swore I would never argue subjectively, but I find it
creepy when a special form overloads an ordinary binary
operator to make it something else. For example:
x = 0
print sqrt(x) or "imaginary"
while adding this 'guard phrase' `if x < 0` will reach back
and re-empower the sqrt return value that `or` would have
Certainly, you could explain this as "That's the way it
is", if it came to that. But it would get in the way of
explaining the normal actions of binary operators, be they
`and`,`or`, `+`, `/` or whatever.
Same goes for `and || else`. The only flaw with `and || or`
as a selection expresion is that it doesn't work. Very
unfortunate that that flaw happens to be fatal.
More information about the Python-list