__iadd__ and fellows missing (Python 2.2)
Jeff Shannon
jeff at ccvcorp.com
Mon Apr 22 16:14:04 EDT 2002
In article <efb63dac.0204221151.6d866042 at posting.google.com>,
juenglin at informatik.uni-freiburg.de says...
> As I found out today, these operations are advertised as in-place
> operations in PEP 203 (see below).
> [Cut out from PEP 203]
>
> They implement the same operator as their normal binary form,
> except that the operation is done `in-place' when the left-hand
> side object supports it...
The key point here being "when the left-hand side object supports
it" -- which clearly implies that immutable objects will not be
modified in place, since they do not support modification.
While there might be some theoretical argument for considering
augmented assignment on immutable types to be an error, keep in
mind that practicality beats purity. Making augmented assignment
on integers into an error would, in practice, be quite silly.
--
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list