mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-36057 Update docs and tests for ordering in collections.Counter [no behavior change] (#11962)
* Add tests for Counter order. No behavior change. * Update docs and tests * Fix doctest output and capitalization
This commit is contained in:
parent
86f093f71a
commit
407c734326
3 changed files with 69 additions and 7 deletions
|
@ -570,8 +570,8 @@ class Counter(dict):
|
|||
'''List the n most common elements and their counts from the most
|
||||
common to the least. If n is None, then list all element counts.
|
||||
|
||||
>>> Counter('abcdeabcdabcaba').most_common(3)
|
||||
[('a', 5), ('b', 4), ('c', 3)]
|
||||
>>> Counter('abracadabra').most_common(3)
|
||||
[('a', 5), ('b', 2), ('r', 2)]
|
||||
|
||||
'''
|
||||
# Emulate Bag.sortedByCount from Smalltalk
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue