Hi, When one writes,
> className='Employee' > baseClasses = ... > dictionary = { ... } > newClass = type( className, <baseClasses>, dictionary) in what module does newClass belong? If it's the current module what code do I run to print out the name of that module in a.b.c... form? Related: If I want to make `newClass' into a module called, say, a.b.c.d.e how do I do that? This doesn't work: > className='a.b.c.d.e.Employee' > newClass = type( className, <baseClasses>, dictionary) As far as I know the correct procedure involves three steps: > import a.b.c.d.e as targetModule > newClass = type( className, <baseClasses>, dictionary) > setattr( targetModule, 'newClassInTarget', newClass ) > obj = targetModule.newClassInTarget() I am not sure if newClass remains a valid type in whatever module it was created in. Final question. If, as an academic exercise I wanted to recursively dump all the classes in a module (and its sub-modules) would I do this? [I use some pseudo code]: def dump( namespace ): for i in dir(namespace): if i is a class: print i elif i is a module: dump(i) dump( <top-level-module> ) Thank you -- http://mail.python.org/mailman/listinfo/python-list