Message412367
Thanks for pointing to reference https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements
Although I can agree it tries to point to similarity with `x = x + 1`, it says about how `x += [1]` is processed:
(1) evaluate the target (`x`)
(2) evaluate the expression list (`[1]`)
(3) call `+=`, which I understand dispatch `x.__iadd__([1])`
I see there is no space left for `UnboundLocalError`.
> The assignment done by augmented assignment statements is handled the same way as normal assignments.
This is not a technical claim. They are not the same, and to claim "they are handled the same way" is strictly speaking an empty statement. For which definition of "same way"? |
|
Date |
User |
Action |
Args |
2022-02-02 15:33:10 | mscholle | set | recipients:
+ mscholle, steven.daprano |
2022-02-02 15:33:10 | mscholle | set | messageid: <1643815990.65.0.6624312354.issue46612@roundup.psfhosted.org> |
2022-02-02 15:33:10 | mscholle | link | issue46612 messages |
2022-02-02 15:33:10 | mscholle | create | |
|