self for modules

Bertram Scharpf b.scharpf at tesionmail.de
Fri Mar 5 08:21:40 EST 2004


Hi,

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


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de



More information about the Python-list mailing list