Confused about a list.sort()

Delaney, Timothy C (Timothy) tdelaney at
Mon Feb 2 00:08:14 CET 2004

> From: James Kew
> ISTR discussion on python-dev about adding a sorted() method to list,
> returning a sorted copy of the list -- did that ever reach a 
> conclusion?

Indeed it did - `list` grew a `sorted` classmethod, but it's now been changed such that `sorted` will be a builtin in 2.4.

`list.sort` and `sorted` also grew a `key` keyword parameter which takes a function to generate the sort keys.

Oh - and `list.sort` has been pronounced to be a stable sort for now and evermore as of Python 2.3.

Tim Delaney

More information about the Python-list mailing list