Accessing class variable at class creation time

Simon Percivall percivall at gmail.com
Fri Sep 23 18:23:46 EDT 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