[issue3051] heapq change breaking compatibility

Jean-Paul Calderone report at bugs.python.org
Fri Jun 6 21:28:48 CEST 2008


Jean-Paul Calderone <exarkun at divmod.com> added the comment:

The heapq documentation isn't very clear about its requirements.  It
does explicitly say that "Heaps are arrays for which heap[k] <=
heap[2*k+1] and heap[k] <= heap[2*k+2] for all k, counting elements from
zero." (this in the module reference for the heapq module, both in the
Python 2.5 version and the in-development version) which might lead one
to believe that <= (__le__) is the important operation.  I don't know
where it is documented that heapq behaves the same as sort().  I think
the documentation needs some improvement to avoid this kind of
confusion.  It's very hard, often impossible, to know what is an
"accidental and erroneous implementation detail" and what is a stable,
public API.

Also, I'm not sure why the code is being changed to accomodate newly
written applications which never could have worked, breaking existing
applications which did work, but I suppose that's just the decision
CPython developers want to make.

----------
nosy: +exarkun

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


More information about the Python-bugs-list mailing list