sorted() erraticly fails to sort string numbers

Paddy O'Loughlin patrick.oloughlin at gmail.com
Thu Apr 30 17:11:35 CEST 2009


2009/4/30 Lie Ryan <lie.1296 at gmail.com>

>   container[:] = sorted(container, key=getkey)
>>
>> .... is equivalent to:
>>
>>   container.sort(key=getkey)
>>
>>
> Equivalent, and in fact better since the sorting is done in-place instead
> of creating a new list, then overwriting the old one.


Not when, as pointed out by uuid, container is not list-like (at least as
far as the sort() method goes).
:)

Paddy

-- 
"Ray, when someone asks you if you're a god, you say YES!"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090430/69cdd1e8/attachment.html>


More information about the Python-list mailing list