[New-bugs-announce] [issue7915] A lists which list.sort seems to leave out of order.
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 < t # It's not in order!
>>> u = [t, t] # Make a list of just the two compared elements and sort
>>> u == [t, t] # Now it's in order!
title: A lists which list.sort seems to leave out of order.
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file16216/list.pickle.gz
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce