The dictionary you get back from globals() is the __dict__ from the current 
module.  __dict__ is a special field which holds the dictionary which holds all 
of the rest of the data on a module.

Another good way to get this dictionary is for the module to import itself and 
then look up the __dict__ member of itself.  As I was testing this, I learned 
that this won't work in IronPython 0.7.5.  That's another bug we need to fix.  
In theory, and in CPython, you should be able to do this.  We'll make this work 
very soon.
-- foo.py --
import sys
dict = sys.modules[__name__].__dict__
----

Thanks - Jim

________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sumit Basu
Sent: Saturday, May 21, 2005 7:30 PM
To: users-ironpython.com@lists.ironpython.com
Subject: [IronPython] getting at the global __dict__ from a module?

Does anyone know how to get at the global __dict__ from inside a module 
(without passing it in as an argument, of course)?   __dict__ is special in 
some way: when you do a dir() at toplevel you don't see it; looking at 
globals() gives you the same info.  Am I missing something?
 
-Sumit
_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to