New submission from wchlm: I observe the following in Python 2.6.1 in CentOS 5.9 and in Python 2.7.5 in MacOS 10.9.2.
A heapified 3-element array containing elements in the order [low, high, medium] fails to print in sorted order, as shown below: >>> import heapq >>> lista = [1, 6, 5, 4] >>> heapq.heapify(lista) >>> lista # Gives sorted order, as expected [1, 4, 5, 6] >>> >>> listb = [1, 6, 5] >>> heapq.heapify(listb) >>> listb # Gives unsorted order -- unexpected and presumably a bug [1, 6, 5] >>> >>> [heapq.heappop(listb) for i in range(len(listb))] # But heappop works [1, 5, 6] ---------- components: Devguide messages: 215805 nosy: ezio.melotti, wchlm priority: normal severity: normal status: open title: heapq fails to print in sorted order for certain inputs type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21185> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com