osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exec and globals and locals ...


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!"