[Python-ideas] cmp and sorting non-symmetric types
Luke Stebbing
luke.stebbing at gmail.com
Thu Nov 15 03:01:50 CET 2007
On 11/14/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Adam Olsen wrote:
> > Thus, set would need 7 methods defined (6 rich comparisons plus
> > __cmp__, although it could skip __eq__ and __ne__)
>
> With the 4-valued __cmp__ that I proposed, it would
> only need __cmp__, I think.
set only needs 4 values, but other types need more. See PEP 207,
Proposed Resolutions, #3:
http://www.python.org/dev/peps/pep-0207/
IMO, such things should not use comparison operators, but I think I'm
in the minority.
Luke
More information about the Python-ideas
mailing list