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 -- http://mail.python.org/mailman/listinfo/python-list