kj wrote: > > Challenge: to come up with a sorting task that cannot be achieved > by passing to the sort method (or sorted function) suitable values > for its key and reverse parameters, but instead *require* giving > a value to its cmp parameter.
Such a task can't exist, because any arbitrary comparison function can be transformed into a key function. The idea behind the transformation is to construct wrapper objects that can compare themselves to other wrapper objects by invoking the given comparison function on their wrapped originals. Google for "Hettinger cmp2key" if you want to see the code that does this transformation. HTH, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list