checking if two things do not equal None

2014-03-29 Thread contact . trigon
if (a, b) != (None, None): or if a != None != b: Preference? Pros? Cons? Alternatives? :D -- https://mail.python.org/mailman/listinfo/python-list

Re: checking if two things do not equal None

2014-03-29 Thread contact . trigon
Do you actually want to check for arbitrary objects which may claim to equal None, or do you want to check for objects which are None? Arbitrary objects are not a concern. if not (a is b is None): ... if a is not b is not None: ... Thanks for the examples. --

Re: checking if two things do not equal None

2014-03-29 Thread contact . trigon
Thanks everyone; it has been very educational. Dave Angel: ...we'll find that two of the alternatives are not even equivalent. That helped me realize (a,b) != (None, None) is not correct for the function. It's a case where two parameters have None as the default argument. What I want is to