Test None for an object that does not implement ==

Roy Smith roy at panix.com
Mon Dec 26 08:43:34 EST 2011


In article <mailman.4097.1324877003.27778.python-list at python.org>,
 Devin Jeanpierre <jeanpierreda at gmail.com> wrote:

> > Um -- if you don't want a and c being passed in, why put them in the
> > function signature?
> 
> He wants both or neither to be passed in.

assert sum(foo is None for foo in [a, c]) % 2 == 0



More information about the Python-list mailing list