Can you create a class from a string name
Brian Quinlan
brian at sweetapp.com
Fri Feb 28 16:58:22 EST 2003
More information about the Python-list mailing list
Fri Feb 28 16:58:22 EST 2003
- Previous message (by thread): Is Python overhyped (just like Java)?
- Next message (by thread): FWIW, Qualified +1 on PEP-0308
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> is there a way to create a class object or an instance object for a
> class if you have the name of the class as a string at the runtime.
>
> For example, in Java you can create a 'Class' object as:
>
> Class.forname ('<classname>')
class = eval('<classname>')
instance = eval('<classname>')(<constructor_args>)
Cheers,
Brian
- Previous message (by thread): Is Python overhyped (just like Java)?
- Next message (by thread): FWIW, Qualified +1 on PEP-0308
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list