PEP 308: Alternative conditional operator forms -- Corner Case solved

Terry Reedy tjreedy at udel.edu
Wed Feb 12 21:33:30 EST 2003


"Dave Brueck" <dave at pythonapocrypha.com> wrote in message
news:mailman.1045088213.3494.python-list at python.org...
> Yes, I've been following that discussion too, but I'm in the camp
that
> says 'and' doesn't readily imply anything about choosing between two
> things anyway,

I have realized just today that at least some of the problem people
have with the and/or combination arises from not having fully
'getting' Python's unusual definition of 'and' and 'or'.  In Python,
they *are* conditional selection operators.  They choose between
alternatives presented as operands and only conditionally evaluate the
second.   They only function as logical operators when *both* operands
are logical values (0/1, False/True for Python).

Given this understanding (which I realize I should explain further),
it is straightforward and obvious that their combination forms a
conditional selection expression, just as the combination a+b*c forms
an arithmetic expression.

>so I'm not keen on building on the current idiom at all.

Given that you presented the view of 'and' behind your unkeenness, it
it easier to understand.  I hope the reverse is true as well.

Terry J. Reedy









More information about the Python-list mailing list