Social problems of Python doc [was Re: Python docs disappointing]

Raymond Hettinger python at
Wed Aug 12 23:24:29 CEST 2009

[Raymond Hettinger]
> Here are a few thoughts on list.sort() for those who are interested:

After one more reading of Xah Lee's posts on the documentation for
here are couple more thoughts:

* The reason that list.sort() allows None for the cmp parameter is not
so that you can write list.sort(None).  It was put there to make it
easier for people writing function definitions where the cmp function
is a possible argument:

   def sort_and_chop(seq, maxlen, cmp=None):
       s = seq[:]
       s.sort(cmp)           # needs to accept None as a possible
       return s[:maxlen]

* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler.  Instead, it was inspired by
decorate-sort-undecorate pattern.


More information about the Python-list mailing list