On 04/15/10 02:03, Paul Rubin wrote: > Raymond Hettinger <pyt...@rcn.com> writes: >> Not sure what the readability issue is. The phrase "nlargest(2, >> iterable)" does exactly what it says, finds the 2 largest elements >> from an iterable. That makes the programmer's intent more clear than >> the slower, but semanticly equivalent form: sorted(iterable)[:2]. > > I think you meant > > sorted(iterable, reverse=True)[:2]
or sorted(iterable)[-2:] -- http://mail.python.org/mailman/listinfo/python-list