SHOW:
|
|
- or go back to the newest paste.
| 1 | class Term: | |
| 2 | def __init__(self, value = 0): | |
| 3 | self.value = value | |
| 4 | ||
| 5 | def __iadd_(self, other): | |
| 6 | self.value += other.value | |
| 7 | return self | |
| 8 | ||
| 9 | f = Term() | |
| 10 | - | f += Term(2) |
| 10 | + | f += Term(2) # TypeError: unsupported operand type(s) for +=: 'instance' and 'instance' |