Creating "virtual" module-namespace
Erik Max Francis
max at alcyone.com
Wed Dec 11 18:51:08 EST 2002
Simon wrote:
> now I want to exec a in a "special" way so that later I can call
>
> exec a in ???????
>
> grail=somthing.nasenbaer()
> grail.singt()
>
> My try was
>
> b=globals()
>
> exec a in b
> grail=b.nasenbaer()
>
> but it failed...
>
> what is the correct way?
You want a separate dictionary:
myGlobals = {}
exec statment in myGlobals
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Even paranoids have real enemies.
\__/ Delmore Schwartz
Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
A personal guide to Aliens vs. Predator 2.
More information about the Python-list
mailing list