Accessing class variable at class creation time

Simon Percivall percivall at gmail.com
Sat Sep 24 00:23:46 CEST 2005


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()




More information about the Python-list mailing list