Test None for an object that does not implement ==

Paul Rubin no.email at nospam.invalid
Sun Dec 25 02:28:00 EST 2011


GZ <zyzhu2000 at gmail.com> writes:
>     assert  (a==None)==(c==None)...
> So how do I reliably test if a value is None or not?

Equality is the wrong comparison to start with.  Use "a is None".



More information about the Python-list mailing list