differentially loading a class at runtime

Maurice LING mauriceling at acm.org
Wed Oct 13 17:48:49 EDT 2004


Hi,

In normal circumstances, we know exactly which class to load and use 
using compile time. But I am now faced with a situation whereby I need 
to load a class differentially at runtime (the user can define which 
class to load).

For example:

class a:
	......

class b:
	......

allowed = ['a', 'b']

'allowed' list will store the names of the alternative classes to use. 
The alternative classes have the same set of methods but different 
implementations.

How can I differentially use the classes at runtime?

Thanks
Maurice



More information about the Python-list mailing list