News for hackers. Stuff that matters.
Re:Have you read your Python Docs Lately? by d0mine on Sunday May 01, 2011 @12:28AM (#2502348)

  def least_common(c, n=None):
      key = operator.itemgetter(1)
      if n is None:
         return sorted(c.items(), key=key)
      return heapq.nsmallest(n, c.items(), key=key)
It has the same efficiency as Counter.most_common().

There are no comments on this comment yet.