[issue7915] A lists which list.sort seems to leave out of order.
Alex Coventry
report at bugs.python.org
Fri Feb 12 03:14:01 CET 2010
New submission from Alex Coventry <throwaway at mit.edu>:
I feel like I must be on crack, here. I apologize if so. English version: sorting this long list leaves in place element 580395, which is less than element 0. Restricting to a list of just those two elements, sorting does what I'd expect.
met% python2.6 # This problem also happens with 2.5
Python 2.6b1+ (trunk:64955, Jul 14 2008, 17:23:39)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, cPickle
>>> t = cPickle.load(os.popen('gunzip -c list.pickle.gz')) # Load the pickle in. It's a list of pairs of numbers
>>> t.sort() # Sort the pickle
>>> t[580395] < t[0] # It's not in order!
True
>>> u = [t[0], t[580395]] # Make a list of just the two compared elements and sort
>>> u.sort()
>>> u == [t[580395], t[0]] # Now it's in order!
True
>>>
----------
files: list.pickle.gz
messages: 99249
nosy: throwaway
severity: normal
status: open
title: A lists which list.sort seems to leave out of order.
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file16216/list.pickle.gz
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7915>
_______________________________________
More information about the Python-bugs-list
mailing list