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

Class BetterCountMissing

example_code/item_048.py:120–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118
119print("Example 8")
120class BetterCountMissing:
121 def __init__(self):
122 self.added = 0
123
124 def __call__(self):
125 self.added += 1
126 return 0
127
128counter = BetterCountMissing()
129assert counter() == 0

Callers 1

item_048.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected