
On 10 Jun 2015 05:00, "Wolfram Hinderer" <wolfram.hinderer@googlemail.com> wrote:
Hm, that's my point, isn't it? The evaluation of subscript() happens after the evaluation of value(). The object that the RHS evaluates to (i.e. value()) is determined before subscript() is evaluated. Sideeffects of subscript() may mutate this object, but can't change *which* object is assigned. But if
x[(a.b as b)] = b
means
b = a.b x[b] = b
That would be: x[b] = (a.b as b)
then the evaluation of the LHS *does* change which object is assigned. That's why I asked for clarification.
Execution order wouldn't change, so it would mean the following: _temp = b b = a.b x[b] = _temp This means you'd get the potentially surprising behaviour where the name binding would still happen even if the subscript assignment fails. However if name bindings *didn't* leak out of their containing expression by default, and while/if/elif code generation instead gained machinery to retrieve the name bindings for any named subexpressions in the condition, that would eliminate most of the potentially bizarre edge cases. Cheers, Nick.