The standard way to set a class attribute is class X(object): i = 1 Given the string 'i', how do I set the class attribute? The following doesn't work (Python 2.2.3): class X(object): setattr(X, 'i', 1) Thanks, Ed Jones