checking if two things do not equal None
Terry Reedy
tjreedy at udel.edu
Sat Mar 29 19:02:08 EDT 2014
On 3/29/2014 2:56 PM, contact.trigon at gmail.com wrote:
> if (a, b) != (None, None):
> or
> if a != None != b:
>
> Preference? Pros? Cons? Alternatives?
if a is not None is not b
==
if a is not None and None is not b
==
if a is not None and b is not None
which is what I would write if not trying to be cute.
a < x < b is more readable as a chained comparison than the double is not.
--
Terry Jan Reedy
More information about the Python-list
mailing list