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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/62IJTVKOYGNATGEV3MCCBLUZRTQKAVOJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to