initialising a class by name
hackingkk at gmail.com
Wed Jan 14 10:51:38 CET 2009
On Wed, 2009-01-14 at 04:09 -0500, Steve Holden wrote:
> You don't need to have the names of the classes related to anything in
> the interface. Just use a list of classes, and have the user interface
> return the correct index for each class. Then (supposing the selection
> by the user is seln) use
> Books = classes[seln]()
> If the classes are all in different modules, import them before creating
> the list of classes.
Is there a way to get the list of all the classes in the package?
I mean is there a way to build a list of modules from some global
variable which can be accessed and then looped through.
More information about the Python-list