[Python-Dev] PEP 558: Defined semantics for locals()
njs at pobox.com
Sat May 25 17:09:20 EDT 2019
On Sat, May 25, 2019, 07:38 Guido van Rossum <guido at python.org> 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?
It's dynamic in that it can spontaneously change when certain other events
happen. For example, imagine this code runs at function scope:
# take a snapshot
a = locals()
# it's a snapshot, so it doesn't include the new variable
assert "a" not in a
# take another snapshot
b = locals()
# now our first "snapshot" has changed
assert "a" in a
Overall I'm happy with the PEP, but I'm still a bit uneasy about whether
we've gotten the details of this "dynamicity" exactly right, esp. since the
PEP promotes them from implementation detail to language features. There
are a lot of complicated tradeoffs so I'm working on a longer response that
tries to lay out all the options and hopefully convince myself (and
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev