[issue21185] heapq fails to print in sorted order for certain inputs

2014-07-03 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> resolved ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread wchlm
wchlm added the comment: All fair enough. I see the error of my ways. I am closing the case with a Resolution of "invalid." Thanks -- resolution: -> invalid status: open -> closed ___ Python tracker _

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: By the way, in the top answer to the Stack Overflow post you linked, it's clear that the list wasn't sorted. [44, 42, 3, 89, 10] became [3, 10, 44, 89, 42], and you'll notice, the last three elements are out of order. -- __

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's not really relevant what a heapified list looks like (and there is no reason to guarantee a particular appearance, since it's an implementation detail that could change). It's supposed to function as a heap with the heap functions, that's all. The docs do

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread wchlm
wchlm added the comment: Hi sahutd, You may be right. I was keying off a stackoverflow example (http://stackoverflow.com/questions/12373837/heapq-module-python) that might have been misleading. In fact, the Python documentation never does say what a printed heapified array is suppose to look

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread Saimadhav Heblikar
Saimadhav Heblikar added the comment: Hi, I dont think its a bug. The textbook definition of a min(or max) heap is "Heaps are binary trees for which every parent node has a value less than or equal to any of its children." Therefore, when lista = [1,6,5,4], and heapify is run on it,it can be

[issue21185] heapq fails to print in sorted order for certain inputs

2014-04-09 Thread wchlm
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] >>>