Python 1.5.2 list sorting bug

Dave Cole djc at itga.com.au
Thu Oct 28 18:14:24 EDT 1999


> actually a much quicker test is:
> Python 1.5.2 (#1, Oct 27 1999, 17:21:07) [C] on irix646
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> a = [3,4,5,1,2]
> >>> a.sort(lambda x,y: x>y)
> >>> a
> [3, 4, 5, 1, 2]
> >>>

heresy:~% python
Python 1.5.2 (#0, Sep 13 1999, 09:12:57)  [GCC 2.95.1 19990816 (release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a = [3,4,5,1,2]
>>> a.sort(lambda x,y: x>y)
>>> a
[3, 4, 5, 1, 2]
>>> a.sort(lambda x,y: cmp(x,y))
>>> a
[1, 2, 3, 4, 5]
>>> 

- Dave




More information about the Python-list mailing list