self for modules

Bertram Scharpf b.scharpf at
Fri Mar 5 14:21:40 CET 2004


when I want to access the module itself, I can write

import sys
module_self = sys.modules[ __name__]

Is there a smarter way to do this?

On the other side, I could express my problem in the
following way: Is it legitimate to say

def f( d):
    d.update( { 'a': 'spam', 'b': 'eggs'})

f( vars())

print a, 'and', b


Thanks for your answers in advance.


Bertram Scharpf
Stuttgart, Deutschland/Germany

More information about the Python-list mailing list