Is it possible to override += in Python?
Yes, override the __iadd__ method. Example:
__iadd__
def __iadd__(self, other): self.number += other.number return self
2.1m questions
2.1m answers
60 comments
57.0k users