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: Add support for a cmp, or key argument to heapq functions.
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Add key argument to heapq functions
View: 1904
Assigned To: Nosy List: alex, rhettinger
Priority: normal Keywords:

Created on 2008-11-25 04:39 by alex, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg76398 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2008-11-25 04:39
Currently the heapq module can only really be used if your data has it's
own ordering defined.  There is no way to do a custom ordering.  From my
cursory review of the code it looks like some of the lower level
functions actually take these kwargs, but the public interface does not.
msg76400 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-11-25 05:40
This is a duplicate of a previously rejected request.  The usual
approach is to load the heap with (priority, record) tuples.
msg76401 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2008-11-25 05:42
Apologies, searching didn't yield that.  That's not necessarily always
easy, for example I'd like to use heapq to merge iterators coming from
the database.
History
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48674
2013-04-27 08:17:14serhiy.storchakasettype: enhancement
superseder: Add key argument to heapq functions
2008-11-25 05:42:19alexsetmessages: + msg76401
2008-11-25 05:40:10rhettingersetstatus: open -> closed
resolution: duplicate
messages: + msg76400
nosy: + rhettinger
2008-11-25 04:39:23alexcreate