Customizing module globals

Fredrik Lundh fredrik at pythonware.com
Fri Sep 7 16:18:54 EDT 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.

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list