[Python-Dev] PEP 558: Defined semantics for locals()
On 5/27/2019 9:52 AM, Richard Damon wrote:
> On 5/27/19 9:12 AM, Terry Reedy wrote:
>> I believe that the situation is or can be thought of as this: there is
>> exactly 1 function locals dict.
per function invocation, or more generally, as Guido said, per stack
frame. This part is obvious to me, but I should have been clearer.
>>? Initially, it is empty and
>> inaccessible (unusable) from code.? Each locals() call updates the
>> dict to a current snapshot and returns it.
> I had a similar concern, and one BIG issue with it being define this way
> is that you get a fundamental re-entrancy problem. If module a uses
> locals(), and then calls module b that uses locals(), module a has lost
> its usage.
No. Sorry about being unclear.
Terry Jan Reedy