Why list.sort() don't return the list reference instead of None?

ankyhe at gmail.com ankyhe at gmail.com
Mon May 8 08:58:19 CEST 2006

Thanks a lot!

However, I wonder why L.sort() don't return the reference L, the
performance of return L and None may be the same.  If L.sort() return
L, we shouldn't do the awful things such as:
keys = dict.keys()
for key in keys:
    ...do whatever with dict[key]...
we can only write the code as follows:
for key in dict.iterkeys().sort():
    ...do whatever with dict[key]...


More information about the Python-list mailing list