Kent Johnson <[EMAIL PROTECTED]> writes:
> use
> max((len(words), i, words) for i, words in enumerate(d.itervalues()))
> 
> The index will always disambiguate and words will never be compared.

OK, but that starts to get pretty obscure.  Supporting key and cmp
args for max and min is a lot cleaner.  Maybe there's some more
general approach to supporting them for all these functions (sorted,
.sort(), min, max, heapq, etc.) in an automatic, uniform way, e.g.  by
wrapping the sequences instead of using keyword args, perhaps by
extending generic __cmp__ somehow.  I'll think about this some more.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to