sort one list using the values from another list

Ron Adam rrr at ronadam.com
Sun Feb 26 21:03:34 EST 2006


Delaney, Timothy (Tim) wrote:
> Ron Adam wrote:
> 
>> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]
>> on win32
>>
>> I was a bit surprised by them being sorted.  I just happend to try
>> d.keys() in place of s2, and it sped up.  I was expecting it to be a
>> bit slower.
> 
> Purely an implementation accident - based entirely on the hash values of
> the objects you've used (i.e. small integers). As you add more data to
> the dictionary, you will definitely reach the point where you no longer
> get keys out in sorted order.
> 
> Tim Delaney

That's what I thought.



More information about the Python-list mailing list