[IronPython] Calling Scope Globals

Dino Viehland dinov at exchange.microsoft.com
Mon Mar 12 17:21:23 CET 2007

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: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] 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.)


users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list