On Thu, Jun 20, 2019 at 8:14 AM Andrew Barnert via Python-ideas <python-ideas@python.org> wrote:
… x = y would mean this:
try: xval = globals()['x'] result = xval.__iassign__(y) except (LookupErrorr, AttributeError): result = y globals()['x'] = result
... Notice that in my pseudocode above, I cheated—obviously the xval = and result = lines are not supposed to recursively call the same pseudocode, but to directly store a value in new temporary local variable.
I'm rather curious how this would behave in a class context. Consider the following code: num = 10; lst = [20, 30, 40] class Spam: num += 1 lst += [50] print(num, lst, Spam.num, Spam.lst) Do you know what this will do in current Python, and what is your intention for this situation if we add a third name that uses the new __iassign__ protocol? ChrisA