New submission from David Coallier: The `collections.Counter` library contains very useful methods for playing with dicts and sets (mainly the most_common()) function.
Even though it is fairly trivial to retrieve the least common elements in a Counter() by doing Counter(...).most_common(n)[:-n:-1] I believe that for the sake of consistency, the `least_common` method should also be available. The attached patch contains the following: - The method definition in Lib/__init__.py to support least_common; - The tests to make sure least_common behaves as expected; - The documentation for 2.7 and the general documentation. Everywhere `most_common` was mentioned, you will now find `least_common` mentioned as well. ---------- components: Library (Lib) files: collections.Counter.least_common.patch keywords: patch messages: 180189 nosy: davidcoallier priority: normal severity: normal status: open title: collections.Counter.least_common type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file28764/collections.Counter.least_common.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16994> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com