Creating "virtual" module-namespace

Harald ghum.19.ghum at spamgourmet.com
Thu Dec 12 11:18:04 EST 2002


Erik Max Francis <max at alcyone.com> wrote in message 

> Attribute access is related to a dictionary by an instance with a
> __dict__ attribute.  You could try something like

YEAH! That worked. EXACTLY the information I've been looking for.


> 	class Dummy: pass
> 	namespace = Dummy() # we just need an instance of _something_
> 	exec code in namespace.__dict__
changing the following lines to


kragenbaer=namespace.nasenbaer()
kragenbaer.singe()

gives me my "tralalala"

Thank you very much...

I was allready digging in the code of import hooks, but did not understand it... 

Thanks for the solution

Harald



More information about the Python-list mailing list