2009/4/30 Lie Ryan
> 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
John Posner wrote:
uuid wrote:
I am at the same time impressed with the concise answer and
disheartened by my inability to see this myself.
My heartfelt thanks!
Don't be disheartened! Many people -- myself included, absolutely! --
occasionally let a blind spot show in their messages to this li
On 2009-04-28 16:18:43 +0200, John Posner said:
Don't be disheartened! Many people -- myself included, absolutely! --
occasionally let a blind spot show in their messages to this list.
Thanks for the encouragement :)
BTW:
container[:] = sorted(container, key=getkey)
... is equivalent
uuid wrote:
I am at the same time impressed with the concise answer and
disheartened by my inability to see this myself.
My heartfelt thanks!
Don't be disheartened! Many people -- myself included, absolutely! --
occasionally let a blind spot show in their messages to this list. BTW:
contai
I am at the same time impressed with the concise answer and
disheartened by my inability to see this myself.
My heartfelt thanks!
On 2009-04-28 10:06:24 +0200, Andre Engels said:
When sorting strings, including strings that represent numbers,
sorting is done alphabetically. In this alphabeti
On Tue, Apr 28, 2009 at 9:47 AM, uuid wrote:
> I would be very interested in a logical explanation why this happens on
> python 2.5.1:
>
> In order to sort an etree by the .text value of one child, I adapted this
> snippet from effbot.org:
>
>> import xml.etree.ElementTree as ET
>>
>> tree = ET.pa
I would be very interested in a logical explanation why this happens on
python 2.5.1:
In order to sort an etree by the .text value of one child, I adapted
this snippet from effbot.org:
import xml.etree.ElementTree as ET
tree = ET.parse("data.xml")
def getkey(elem):
return elem.findtext