classobj?

Venky venky at nospam.com
Mon Feb 26 20:43:44 EST 2007


Hi,

I am trying to create classes at runtime based on input from a textfile. 
I am trying to use the function new.classobj. I am able to create the 
new classes successfully, however I fail to understand on how to add 
this new class to the current dictionary.

cl = new.classobj('SomeClass', (BaseClass, ), {})

After this call, how do I instantiate SomeClass?

I understand cl() will instantiate this, however this defeats my 
purpose, since the name of the class is obtained at runtime.

Thanks

venky



More information about the Python-list mailing list