[Python-Dev] Re: Comments on PEP 558

2021年2月08日 09:29:39 -0800

Hi Mark,
On 04.02.21 12:47, Mark Shannon wrote:
Hi Sven,
On 04/02/2021 9:06 am, Sven R. Kunze wrote:
As long as it is possible to **write** to existing keys to **add new keys** to frame.f_locals, I am actually quite happy.
Out of interest, why would you want to add new keys to the locals of a function frame?
I use it for remote execution in human-friendly manner.
I plan to opensource the lib for everybody to use, so I was a worried that this change could break it.
The function will never be able to use those values.
I realize quite now that the use-case usually is on module-level where locals=globals:
>>> import sys
>>> frame=sys._getframe(0)
>>> frame.f_locals['testvar']='testvalue'
>>> print(testvar)
testvalue
>>>
So, setting a var was never an issue; also probably because it's seldomly used in this context. Funny enough, that the lib would even start to work properly when functions-locals would be writable.
Regards,
Sven
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/S3QQKTVFXWBMAETNDNXNLYZDJABGHT63/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to