My first ever Python program, comments welcome

MRAB python at mrabarnett.plus.com
Sun Jul 22 03:56:20 CEST 2012


On 22/07/2012 01:32, Steven D'Aprano wrote:
> 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.
>
Since the result is bound to the original name, the
result is the same.




More information about the Python-list mailing list