Python 3 __cmp__ semantic change?

Johannes Bauer dfnsonfsduifb at gmx.de
Fri Nov 21 00:44:09 CET 2008


Steve Holden schrieb:

> If it's not present then it would be worth reporting it as a 3.0 bug -
> there's still time to get it in, as the release isn't due until early
> December.

Seems it was removed on purpose - I'm sure there was a good reason for
that, but may I ask why? Instead of the sleek __cmp__ function I had
earlier, I now have code like:


def __lt__(self, other):
	return self.__cmp__(other) < 0
	
def __le__(self, other):
	return self.__cmp__(other) < 0
	
def __gt__(self, other):
	return self.__cmp__(other) > 0

def __ge__(self, other):
	return self.__cmp__(other) >= 0

Does anyone know the reason why __cmp__ was discarded?

Kind regards,
Johannes

-- 
"Meine Gegenklage gegen dich lautet dann auf bewusste Verlogenheit,
verlästerung von Gott, Bibel und mir und bewusster Blasphemie."
         -- Prophet und Visionär Hans Joss aka HJP in de.sci.physik
                         <48d8bf1d$0$7510$5402220f at news.sunrise.ch>



More information about the Python-list mailing list