Описание тега counter
A Counter is a container(/bag/multiset/etc.) that keeps track of how many times equivalent values are added.
In Python:
A
Counter
is adict
subclass for counting hashable objects. It is an unordered collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Counts are allowed to be any integer value including zero or negative counts. TheCounter
class is similar to bags or multisets in other languages.
http://docs.python.org/library/collections.html