Dynamically add Class to Modules

callmebill at gmail.com callmebill at gmail.com
Thu Dec 8 20:31:48 EST 2005


Oh!  I see what I missed.  I didn't supply the namespace into which the
new class was going to be added (correct that statement, please, if it
is incorrect).

So by using this slight modification, thinks seemed to work:
exec testModule.TheTestCode %(testModule.TheTestName,

testModule.TheTestName ) in testModule.__dict__

...and boom it appeared in the 2nd dir.

Did i do good?




More information about the Python-list mailing list