Thanks all for replying.

Let me be clear,

>>> l = [2,1]

>>> id(l[0])
8402300
>>> id(l[1])
8402312

>>> l.sort()

>>> id(l[0])
8402312
>>> id(l[1])
8402300

So if we had   [l] ------>  [0]  -----> 2
                                   [1]  -----> 1

after the sort, the index [0] binds to  the '1' memory location and index
[1] binds to '2'.



Now if we have, d = {'a':1, 'b':2}
>>> l = d.keys().sort()
>>> print l
None


d.keys() is a list  which references the keys of the dictionary.
But the sort method does not do what is intended on this list?

--Bhaskar.
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to