Overloading In-Place Operators
Mon 10 August 2026
class Counter:
def __init__(self, value):
self.value = value
def __iadd__(self, other):
self.value += other
return self
c = Counter(10)
c += 5
print(c.value) # Output: 15
15
Score: 10
Category: chapter5_operator_overloading