Message217217
This is not limited to dictionaries. Augmented assignment *always* involves a read operation and a write operation.
So Antoine's remark in msg215573 is more general;
a.x += 1
has a get and a set, and even
x += 1
has a get and a set.
I still agree that the original statement is confusing. It (implicitly) claims that
x = x + 1
evaluates x twice, which it does not. Instead, x is only *evaluated* once, and then written to. Only if x has subexpressions, they get evaluated only once ("evaluation" being the thing that produces a "value"). |
|
Date |
User |
Action |
Args |
2014-04-26 21:03:57 | loewis | set | recipients:
+ loewis, terry.reedy, docs@python |
2014-04-26 21:03:57 | loewis | set | messageid: <1398546237.47.0.497573586139.issue21358@psf.upfronthosting.co.za> |
2014-04-26 21:03:56 | loewis | link | issue21358 messages |
2014-04-26 21:03:56 | loewis | create | |
|