MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / FrequencyList

Class FrequencyList

example_code/item_057.py:51–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50print("Example 1")
51class FrequencyList(list):
52 def __init__(self, members):
53 super().__init__(members)
54
55 def frequency(self):
56 counts = {}
57 for item in self:
58 counts[item] = counts.get(item, 0) + 1
59 return counts
60
61
62print("Example 2")

Callers 1

item_057.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected