A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-March/087004.html below:

[Python-Dev] Deprecated __cmp__ and total ordering

[Python-Dev] Deprecated __cmp__ and total ordering [Python-Dev] Deprecated __cmp__ and total orderingRaymond Hettinger python at rcn.com
Tue Mar 10 14:53:26 CET 2009
[Mart Sõmermaa]
> To provide total ordering without __cmp__ one has to implement all of
>  __lt__, __gt__, __le__, __ge__, __eq__ and __ne__. However, in all
> but a few cases it suffices only to provide a "real" implementation for
> e.g. __lt__ and define all the other methods in terms of it as follows:

FWIW, I'm working on a solution for the problem using class decorators.
The idea is that it would scan a class and fill-in missing methods based
on the ones already there.  That way, any one of the four ordering
relations can be provided as a starting point and we won't have to
annoint one like __lt__ as the one true underlying method.

When it's ready, I'll bring it to python-dev for discussion.


Raymond 

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4