checking if two things do not equal None

Jeremy Sanders jeremy at jeremysanders.net
Mon Mar 31 09:56:59 CEST 2014


contact.trigon at gmail.com wrote:

> if (a, b) != (None, None):
> or
> if a != None != b:
> 
> Preference? Pros? Cons? Alternatives?

I couldn't see anyone else give this, but I like

if None not in (a, b):
 pass

Jeremy





More information about the Python-list mailing list