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

Paul Rubin http
Mon Aug 17 22:56:13 CEST 2009


Jon Harrop <jon at ffconsultancy.com> writes:
> You mean people use that pattern as a fast alternative in languages where
> user-defined functions are very slow, like Python and Mathematica?

It really doesn't matter whether the language is fast or slow--there
are going to be applications where calling the comparison function
multiple times per element is slower than calling it once per element
and storing the result.

Note the Haskell idiom (sortBy (compare`on`f) xs) is similar to DSU
but calls the comparison function multiple times.

Python 3.0 went overboard by actually removing the cmp argument and
requiring use of the key argument.  That requires various kludges if
the key is, say, a tree structure that has to be recursively compared
with another such structure.  Maybe then can bring back cmp someday.



More information about the Python-list mailing list