[Tutor] iterator question for a toy class

Kent Johnson kent37 at tds.net
Sat Apr 23 13:04:37 CEST 2005

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.


More information about the Tutor mailing list