[Tutor] get a module's own (top_level) dict?

spir denis.spir at free.fr
Sun Nov 9 11:34:37 CET 2008


Hello pyhonistas,

Example:
=== module content ===
a = 1
b = 2
======================

I'm looking for a way to get something like {'a':a, b':2}. Actually, names 
defind in the module will be instances of a custom type. I want to give them an 
attribute that holds their own name. E.g.:
for key,obj in dict:
	obj.name = key


More information about the Tutor mailing list