MCPcopy Create free account
hub / github.com/dabeaz-course/python-mastery / __iadd__

Method __iadd__

Solutions/2_4/mutint.py:36–44  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

34
35 # Support for in-place update (MutInt += other)
36 def __iadd__(self, other):
37 if isinstance(other, MutInt):
38 self.value += other.value
39 return self
40 elif isinstance(other, int):
41 self.value += other
42 return self
43 else:
44 return NotImplemented
45
46 # Support for equality testing
47 def __eq__(self, other):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected