[Python-Dev] Re: Re: lists v. tuples
Raymond Hettinger
python@rcn.com
Sun, 16 Mar 2003 16:59:56 -0500
> one minor problem with the six __lt__ etc is that they should be all defined.
> For quick things (although I know better) I still define just __cmp__ out of
> laziness.
Sometime back, I proposed a mixin for this.
class C(CompareMixin):
def __eq__(self, other): ...
def __lt__(self, other): ...
The __eq__ by itself is enough to get __ne__ defined for you.
Defining both __eq__ and __lt__ gets you all the rest.
Raymond Hettinger
#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################