make a class instance from a string ?
Luke Plant
luke.plant at gmail.com
Thu Feb 23 08:22:25 EST 2006
Bo Yang wrote:
> I know in java , we can use
>
> class.ForName("classname")
>
>
> to get an instance of the class 'classname' from a
> string , in python , how do I do that ?
In Python, classes are first class objects, so normally you would pass
the class itself around, rather than use the names of classes. Of
course that might not be practical or applicable in your situation.
Luke
More information about the Python-list
mailing list