dynamic class/module use? (like Java's forName)
Alex Hunsley
lard at tardis.ed.ac.molar.uk
Sat Jul 17 14:00:26 EDT 2004
Does python provide a way to dynamically use modules and/or classes?
I'm thinking in the vein of Java's Class.forName.
As a pseudocode example, I'm looking for the following ability:
classIWantToInstantiate = "packagenamehere.classNameHere"
anInstanceOfThatClass = makeNewClassFromString(classIWantToInstantiate,
parameters[])
# now anInstanceOfThatClass refers to an instantied
# packagenamehere.classNameHere object!
thanks
alex
More information about the Python-list
mailing list