My first ever Python program, comments welcome
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat Jul 21 20:32:39 EDT 2012
On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote:
> On 21/07/2012 20:08, Lipska the Kat wrote:
>> l=sorted(l, key=itemgetter(0))
>
> Short is:
>
> l.sort(key=itemgetter(0))
Shorter, and the semantics are subtly different.
The sorted function returns a copy of the input list.
The list.sort method sorts the list in place.
--
Steven
More information about the Python-list
mailing list