Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-28 Thread Nathaniel Smith
On Tue, May 28, 2019 at 5:24 PM Greg Ewing wrote: > > Terry Reedy wrote: > > I believe that the situation is or can be thought of as this: there is > > exactly 1 function locals dict. Initially, it is empty and inaccessible > > (unusable) from code. Each locals() call updates the dict to a curre

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-28 Thread Nathaniel Smith
On Tue, May 28, 2019 at 6:02 PM Guido van Rossum wrote: > > On Tue, May 28, 2019 at 5:25 PM Greg Ewing > wrote: >> >> Terry Reedy wrote: >> > I believe that the situation is or can be thought of as this: there is >> > exactly 1 function locals dict. Initially, it is empty and inaccessible >> >

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-28 Thread Guido van Rossum
On Tue, May 28, 2019 at 5:25 PM Greg Ewing wrote: > Terry Reedy wrote: > > I believe that the situation is or can be thought of as this: there is > > exactly 1 function locals dict. Initially, it is empty and inaccessible > > (unusable) from code. Each locals() call updates the dict to a curren

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-28 Thread Greg Ewing
Terry Reedy wrote: I believe that the situation is or can be thought of as this: there is exactly 1 function locals dict. Initially, it is empty and inaccessible (unusable) from code. Each locals() call updates the dict to a current snapshot and returns it. Yes, I understand *what's* happen

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-27 Thread Terry Reedy
On 5/27/2019 3:18 AM, Greg Ewing wrote: Chris Angelico wrote: Except that it does. After calling locals() a second time, the result of the *first* call will be updated to reflect changes. Yeow. That's *really* unintuitive. There had better be an extremely good reason for this behaviour. I be

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-27 Thread Greg Ewing
Chris Angelico wrote: Except that it does. After calling locals() a second time, the result of the *first* call will be updated to reflect changes. Yeow. That's *really* unintuitive. There had better be an extremely good reason for this behaviour. -- Greg __

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-26 Thread Steven D'Aprano
Richard, your email seems to have introduced a spurious "SPAM" label to this thread, which may confuse some email clients into treating it as spam. Can you teach your email program that this mailing list is ham, not spam, or failing that, at least edit the subject line to remove the label? Thanks.

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-25 Thread Chris Angelico
On Sun, May 26, 2019 at 8:38 AM Richard Damon wrote: > > On 5/25/19 5:09 PM, Nathaniel Smith wrote: > > a = locals() > > b = locals() > > # now our first "snapshot" has changed > > assert "a" in a > > > To me that is a static snapshot of a dynamic environment, not a dynamic > snapshot. The snapsho

Re: [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()

2019-05-25 Thread Richard Damon
On 5/25/19 5:09 PM, Nathaniel Smith wrote: > On Sat, May 25, 2019, 07:38 Guido van Rossum > wrote: > > This looks great. > > I only have two nits with the text. > > First, why is the snapshot called a "dynamic snapshot"? What > exactly is dynamic about it?