namespace question

Alex Martelli aleaxit at
Sat Sep 4 11:00:29 CEST 2004

Elaine Jackson <elainejackson7355 at> wrote:

> It's what I want in the sense that it returns the correct dictionary when
> globals is invoked interactively. What I want is to have a function that
> can be
> imported into the interpreter and that will return that same dictionary.

so what's wrong with:

def main_dictionary():
    import __main__
    return vars(__main__)


More information about the Python-list mailing list