On 12/25/2011 08:38 PM, Nobody wrote:

nothing should compare equal to None except for None itself, so "x is None"
> and "x == None" shouldn't produce different results unless there's a
> bug in the comparison method.

not necessarily, for example:

import random
class OddClass:
    def __eq__(self, other):
        return [True, False][random.randint(0, 1)]

x = OddClass()
print x == None
print x == None
print x == None
print x == None
print x == None


Now, whether doing something like that is advisable or not, that's a different question; however nothing in python states that you couldn't have something that compare equal to None whether there is a bug or not in the comparison method.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to