A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2019-May/157709.html below:

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

[Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals() [Python-Dev] [SPAM?] Re: PEP 558: Defined semantics for locals()Chris Angelico rosuav at gmail.com
Sat May 25 18:44:33 EDT 2019
On Sun, May 26, 2019 at 8:38 AM Richard Damon <Richard at damon-family.org> 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 snapshot you get at THAT moment in time won't change, as
> time progresses, so that snapshot itself isn't dynamic.

Except that it does. After calling locals() a second time, the result
of the *first* call will be updated to reflect changes. It's not a
frozen snapshot; you can't diff the two dictionaries to see what's
changed (unless you use "a = dict(locals())" or something, which IS a
snapshot).

>From my reading of the description, you could also "assert a is b" -
is that correct?

ChrisA
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4