Customizing module globals

Fredrik Lundh fredrik at
Fri Sep 7 22:18:54 CEST 2001

Kerim Borchaev wrote:

> But there _is_ a module that isn't explicitly imported - __builtins__ .

that module's called "__builtin__", not "__builtins__".

> And may be one can specify other names to be present in module's
> namespace just before it is executed?

you can install things in the __builtin__ module at any time:

    import __builtin__
    __builtin__.Object = something

using this to fake "true globals" is a pretty lousy idea, imho.


<!-- (the eff-bot guide to) the python standard library:

More information about the Python-list mailing list