exec and globals and locals ...
Peter Otten
__peter__ at web.de
Thu Sep 19 09:49:08 EDT 2019
Eko palypse wrote:
> Thank you, I'm currently investigating importlib and read that
> __builtins__ might be another alternative.
> My ultimate goal would be to have objects available without the need to
> import them, regardless whether used in a script directly or used in an
> imported module.
I'm not sure this is a good idea. Or rather, I'm pretty sure this isn't a
good idea ;)
To quote the Zen of Python
>>> import this
The Zen of Python, by Tim Peters
[...]
Namespaces are one honking great idea -- let's do more of those!
It looks like you are replacing that line with
"Let's put everything into builtins -- so convenient, no!"
More information about the Python-list
mailing list