__eq__ and __ne__

Shane Hathaway shane at ZOPE.COM
Tue Jul 8 12:08:22 EDT 2003


Tim Peters wrote:
> Since the richcmp operators aren't constrained to return scalars, an attempt
> to define one in terms of the others seemed futile.  Instead they're 6
> independent methods.

Ok.  Thanks for finding the docs.  I guess I'll stick to my boilerplate 
code.  I think some guidance should be added to the Python docs, though, 
explaining that whenever you define __eq__, you very likely ought to 
define __ne__ also.

Shane






More information about the Python-list mailing list