[New-bugs-announce] [issue20905] Adapt heapq push/pop/replace to allow passing a comparator.

Prashant Sharma report at bugs.python.org
Thu Mar 13 09:18:17 CET 2014


New submission from Prashant Sharma:

It would be more convenient to extend heapq to support user defined comparators. 

Default can be cmp_lt in which case they behave as they do now. 

Caveat:
What happens if uses switches comparator between calls to push or pop. The expected behavior can be unpredictable and should be obvious to the user of the API. It might also be good to state this obvious, if people here agree. 

P.S. I am really new to python world, forgive me for any kind of stupidity. Criticism and comments is what I am looking for here !

----------
components: Library (Lib)
files: heapq_com.patch
keywords: patch
messages: 213361
nosy: Prashant.Sharma
priority: normal
severity: normal
status: open
title: Adapt heapq push/pop/replace to allow passing a comparator.
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file34388/heapq_com.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20905>
_______________________________________


More information about the New-bugs-announce mailing list