Creating "virtual" module-namespace
Harald
simon.12.ghum at spamgourmet.com
Thu Dec 12 16:34:22 EST 2002
Robin,
thank you very much for taking time to clarify!
> What is happening here is that a name 'foo' is created in the namespace
> of object 'something' -- so it is therefore accessed by 'something.foo'
> since the period operator means namespace lookup.
Coming from C++, Java, VB, PHP ... I was not able to imagine that much
orthogonal design.
Python is overwhelming in his clear concepts.
> Python's absolute separation between the concept of names and what they
> point to is one of the biggest sources of confusion that I have seen;
So I know: I need an object only to form a namespace which I can access
via "."
I think it would be possible to use something else instead of an
object...
Do something like
zoo=[] # empty list
exec a in zoo.__dict__ # execute a in the namespace of "zoo"
Thank you very much
Harald
More information about the Python-list
mailing list