[Michael Foord]
> Is there something you don't like about this one:
http://code.activestate.com/recipes/576529/
[Mart Sõmermaa ]
Yes -- it is not in the standard library. As I said, eventually all the 15,000
matches
on Google Code need to update their code and copy that snippet to their
uti
Mart Sõmermaa wrote:
On Tue, Mar 10, 2009 at 3:57 PM, Michael Foord
mailto:fuzzy...@voidspace.org.uk>> wrote:
Is there something you don't like about this one:
http://code.activestate.com/recipes/576529/
Yes -- it is not in the standard library. As I said, eventually all
the 15,00
On Tue, Mar 10, 2009 at 3:57 PM, Michael Foord wrote:
> Is there something you don't like about this one:
> http://code.activestate.com/recipes/576529/
>
Yes -- it is not in the standard library. As I said, eventually all the
15,000 matches on Google Code need to update their code and copy that
s
Raymond Hettinger wrote:
[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 method
[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
Raymond Hettinger wrote:
[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
[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
Hello Mart,
This has been discussed before. Guido was against automatically filling
in these methods based I think on the fact that this may not be what you
want - worth searching the archives for.
See here for a class decorator that provides all rich comparison methods
for classes that only
__cmp__ used to provide a convenient way to make all ordering operators work
by defining a single method. For better or worse, it's gone in 3.0.
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