Title: Add support for a cmp, or key argument to heapq functions.
Type: enhancement Stage:
Components: Library (Lib) Versions:
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 2013-04-27 08:17 by serhiy.storchaka. 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.
Date User Action Args
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