PEP 308 - suggestion for generalising the ternary operator

Terry Reedy tjreedy at udel.edu
Sat Feb 15 11:28:32 EST 2003


"Damien Morton" <newsgroups1 at bitfurnace.com> wrote in message
news:mailman.1045303854.13593.python-list at python.org...
>
> "Terry Reedy" <tjreedy at udel.edu> wrote in message
> > Since I just discovered the alternate form "(not c or x) and y",
which
> > works when x is null rather than non-null, years after noticing
the
> > and/or form. I have to admit that these are not quite as intuitive
as
> > I thought.  (See (PEP-308) Python's Conditional Selection
Operators)
> > One has to look at the definitions of and/or several times and
work
> > out the effect of combinations to fully get how they operate.
>
> got me wondering if "nand" or "nor" operators might help :)

Not obviously.  As I explained in the referenced post, only 'and' and
'or' are selective.  'a nand b' pretty much has to be one of
False,True rather than one of a,b.

Terry J. Reedy






More information about the Python-list mailing list