Hi all - it would seem that these days, all the cool kids use the sort
function's 'key' kwarg in order to sort a list of custom objects quickly.

Unfortunately, as opposed to using 'cmp', where you can implent __cmp__ to
get 'automatic sorting' in a similar fashion, there doesn't seem to be a
direct analogue for a class-overridable method for providing a sort key.
 (ie, something like '__sortkey__' or '__key__').

Is there one, and I'm just missing it? If not, are there any plans to add
one? (I did a quick search of the PEP list, and the only hits for 'sort' I
saw had to do with sorting dictionaries by value).

- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to