Unfortunately I can't think of a clever way to do this other than flowing in 
the calling scope explicitly somehow (e.g. passing in __name__) which I assume 
is not a good enough ugly hack :).


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
Sent: Saturday, March 10, 2007 5:27 AM
To: Discussion of IronPython
Subject: [IronPython] Calling Scope Globals

Hello all,

Occasionally I have code that would like to know what module (scope)
some code is being called from. In CPython I would do :

calling_scope = sys._getframe(1).f_globals['__name__']

How can I do this in IronPython ? (Ugly hacks accepted.)

Thanks

Michael
http://www.voidspace.org.uk/ironpython/
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to