structa.collections

class structa.collections.FrozenCounter(it)[source]

An immutable variant of the collections.Counter class from the Python standard library.

This implements all readable properties and behaviours of the collections.Counter class, but excludes all methods and behaviours which permit modification of the counter. The resulting instances are hashable and can be used as keys in mappings.

elements()[source]

See collections.Counter.elements().

classmethod from_counter(counter)[source]

Construct a FrozenCounter from a collections.Counter instance. This is generally much faster than attempting to construct from the elements of an existing counter.

The counter parameter must either be a collections.Counter instance, or a FrozenCounter instance (in which case it is returned verbatim).

most_common(n=None)[source]

See collections.Counter.most_common().