28 ms·
You could do `y = x.__setitem__(0, 10)`, but you cannot assign `x[0] = 10` to a new variable. If `__setitem__` was overridden, you would not be able to distingu
by maurosilber 3y ago
You could do `y = x.__setitem__(0, 10)`, but you cannot assign `x[0] = 10` to a new variable. If `__setitem__` was overridden, you would not be able to distinguish between these cases and raise an error in the second one.
- wodenokoto 3y agoYes, that makes perfect sense. I somehow completely missed the assignment part of the second example. Thank you for the clarification.