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

Chris Angelico rosuav at gmail.com
Sun May 26 07:20:53 EDT 2019


On Sun, May 26, 2019 at 8:07 PM Steven D'Aprano <steve at pearwood.info> wrote:
> On Sun, May 26, 2019 at 08:44:33AM +1000, Chris Angelico wrote:
>
> > From my reading of the description, you could also "assert a is b" -
> > is that correct?
>
> Yes, that's already the behaviour.
>
> py> def demo():
> ...     a = locals()
> ...     b = locals()
> ...     print(a is b)
> ...
> py> demo()
> True
>

Sure, but this PEP is all about defining things that weren't
previously defined, so I wanted to clarify intent rather than current
behaviour.

ChrisA


More information about the Python-Dev mailing list