
On Thu, Apr 28, 2011 at 10:01 AM, Steven D'Aprano <steve@pearwood.info> wrote:
Alexander Belopolsky wrote: .. I think I would like to see a demonstration of this rather than just take your word for it.
sorted([4, 5, 1, float('nan'), 3, 2]) [1, 2, 3, 4, 5, nan]
Hmm, a quick search of the tracker yielded issue7915 which demonstrates how presence of nans causes sort to leave a list unsorted. Using binary search on unsorted data leads to nonsensical results, but I don't seem to be able to produce infinite loops with python's bisect. Maybe I saw nan-caused infinite loops in some other libraries. I learned long ago to rid my data of NaNs before doing any type of comparison, so my recollection of the associated problems is admittedly vague. I'll try to come up with something, though. http://bugs.python.org/issue7915