vdrab wrote: >> beasts. It can get even worse: I can define an object (in C++ as well as >> in python) that is not even equal to itself. Not that I felt the need for >> that so far.... > > hehe... now you've picked my curiosity... how? > > ps. > def __eq__(self, other): return False > does not count !
Sure it does! The rich comparison methods can very well be used to define whatever semantics you want. Now I agree that def __eq__(self, other): if self is other: return False ... # do something more sane doesn't make much sense usually. Or maybe even never. Still, it illustrates the point: object identity is not to be confused with two objects being part of an equality relation. Diez -- http://mail.python.org/mailman/listinfo/python-list