[Python-3000] Total ordering and cmp (original) (raw)

Guido van Rossum guido at python.org
Wed Mar 21 02:30:40 CET 2007


I haven't taken any action, and it looks like cmp isn't being called. I'd rather not add it back; if you want it back, could you at least write up a brief PEP? A patch would also help; I recall that it was quite a relief being able to cut it out, so I expect that patching it back in would be quite cumbersome.

--Guido

On 3/20/07, Collin Winter <collinw at gmail.com> wrote:

Quoting from the commit message for r51533, which removed the default ordering:

""" A general problem with getting lots of these tests to pass is the reality that for object types that have a natural total ordering, implementing cmp is much more convenient than implementing eq, ne, lt, and so on. Should we go back to allowing cmp to provide a total ordering? Should we provide some other way to implement rich comparison with a single method override? Alex proposed a key() method; I've considered a richcmp() method. Or perhaps cmp() just shouldn't be killed off... """ What's the status on this? FWIW, I would like to see cmp stay as a fallback measure if eq, ne, lt, etc aren't defined for total ordering purposes. I've run across this while trying to get the docs toolchain working, and I was initially shocked that cmp was no longer called. Collin Winter


Python-3000 mailing list Python-3000 at python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list