Hi,

I run into a weird problem. I have a piece of code that looks like the
following:

f(...., a=None, c=None):
    assert  (a==None)==(c==None)


The problem is that == is not implemented sometimes for values in a
and c, causing an exception NotImplementedError.

I ended up doing assert (not a)==(not c), but I think this code has
other issues, for example, when a=[] and c=['a'], the assertion will
fail, although a is not None.

So how do I reliably test if a value is None or not?

Thanks,
gz
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to