It might be that I'm complicating something easy here, but I immediately thought of
import sys class A: X = 2 def F(): f = sys._getframe().f_back print f.f_locals["X"] F() -- http://mail.python.org/mailman/listinfo/python-list
It might be that I'm complicating something easy here, but I immediately thought of
import sys class A: X = 2 def F(): f = sys._getframe().f_back print f.f_locals["X"] F() -- http://mail.python.org/mailman/listinfo/python-list