PEP 308 - suggestion for generalising the ternary operator

Terry Reedy tjreedy at
Sat Feb 15 17:28:32 CET 2003

"Damien Morton" <newsgroups1 at> wrote in message
news:mailman.1045303854.13593.python-list at
> "Terry Reedy" <tjreedy at> wrote in message
> > Since I just discovered the alternate form "(not c or x) and y",
> > works when x is null rather than non-null, years after noticing
> > and/or form. I have to admit that these are not quite as intuitive
> > I thought.  (See (PEP-308) Python's Conditional Selection
> > One has to look at the definitions of and/or several times and
> > 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