This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cmp() is missing in 3.x
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, ezio.melotti, flox, loewis
Priority: normal Keywords:

Created on 2010-02-01 19:47 by flox, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg98680 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-01 19:47
The cmp(a, b) function is missing in 3.0.

This change is slightly documented in Doc/whatsnew/3.0.rst:
"The cmp() function should be treated as gone."

There's no "-3" warning and no 2to3 fixer for it.
msg98685 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-01 20:20
As a replacement, it could be useful to propose a "universal key" for sort() method and sorted() builtin.

>>> lst = sorted([{2: '3'}, 1, '05'], key=list.ukey)
>>> 


There's a reference implementation in the pprint._safe_key private class.
msg98690 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-02-01 21:11
No, cmp is not missing. It's intentionally removed, and won't come back. So closing this as "won't fix".

I'm not sure what you are aiming at with the universal key function; if you want a key function that guarantees a total order, use key=id.
msg98691 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-01 21:22
Ok.
Maybe we need a "-3" warning and/or a 2to3 fixer?
msg98693 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-02-01 21:54
I think this should be discussed on python-dev (I believe it *has* been discussed on python-dev, I just don't remember the outcome). Creating fixers is not feasible, I think. In any case, it's an issue different from the one you reported.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52079
2010-02-02 09:57:49ezio.melottisetnosy: + ezio.melotti
2010-02-01 21:54:30loewissetmessages: + msg98693
2010-02-01 21:46:02eric.araujosetnosy: + eric.araujo
2010-02-01 21:24:33floxsetversions: - Python 2.6
2010-02-01 21:22:38floxsetmessages: + msg98691
components: + 2to3 (2.x to 3.x conversion tool)
versions: + Python 2.6, Python 2.7
2010-02-01 21:11:44loewissetstatus: open -> closed

nosy: + loewis
messages: + msg98690

resolution: wont fix
2010-02-01 20:20:37floxsetmessages: + msg98685
2010-02-01 19:47:42floxcreate