Bug in Python?

eryk sun eryksun at gmail.com
Fri Feb 26 18:29:54 EST 2016


On Fri, Feb 26, 2016 at 4:37 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> So I would guess that the difference here is because one
> implementation is entirely C, and the other implementation is entirely
> Python.

Exactly, the C implementation of siftup is only called internally. So
there's no need to export it as a function. Calling the C heappop
calls this internal siftup implementation, which uses the
_PyList_ITEMS macro to reference the list's internal ob_item array.
Thus all of the assignment operations party directly on the array
instead of using the abstract API.


More information about the Python-list mailing list