None or 0
Terry Reedy
tjreedy at udel.edu
Sat Sep 7 18:05:49 EDT 2002
To summarize Tim's thorough answer:
the language reference guarantees (specifies) the short-circuit
behavior
that you discovered. It also guarantees that
> a = a or b
is *not* equivalent to
> if a is None: a = b
unless *you* can guarantee that 'a' will never have a null value other
than None.
I add: as far as I know, both have been true since the beginning and
will remain true thru the 2.x series. I would be extremely surprised
if anything changed thereafter.
Terry J. Reedy
More information about the Python-list
mailing list