Strange namespace issue

Chris Angelico rosuav at gmail.com
Tue Aug 11 22:27:14 EDT 2020


On Wed, Aug 12, 2020 at 12:03 PM Lele Gaifax <lele at metapensiero.it> wrote:
> But I see this is somewhat fragile, and wonder about a proper fix, but isn't
> that a reasonable usage of the "locals" argument to exec()?
>

I'm not sure. Passing a locals argument to eval() I have sometimes
done, but never exec(). I've always exec'd code at top level and then
extracted something from globals - it seems the easiest.

ChrisA


More information about the Python-list mailing list