inconsistency with += between different types ?
Donn Cave
donn at u.washington.edu
Thu Aug 8 13:25:18 EDT 2002
Quoth Andreas.Leitgeb at siemens.at (Andreas Leitgeb):
...
| Because += already has this fallback to __add__ builtin, __iadd__
| shouldn't care about the immutable case. It need not even exist for
| that case. Now for the mutable case, it should be __iadd__'s only
| job to get the mutation done on the object.
This would force the programmer to rely on the absence of __iadd__
to implicitly get the desired behavior. It's clearer (and faster,
cf. Timothy Delaney's followup) to make it explicit.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list