Kent Johnson wrote:
Rich Krauter wrote:

2) Or, if you really want your __eq__ method to use the iterator returned by __iter__(),

def __eq__(self, other):
    for i, j in map(None,self, other):
        if i != j:
            return False
    return True


That's not right either, it will compare Foo([None], []) == Foo([], []) for example.

Kent, Yikes, I should have seen that. Thanks for pointing out the error.

Rich
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to