> Inside of the setup() function, a call to the cgi object determines > the name of the calling application (form1,py ... etc.) and > then imports another module (automatically generated from another > process), always having the same members, composing that auto module > name from the name of the calling application: form1.py => > form1_extra.py...... And if I have to change the algorithm that > determines the name of the module imported or the names of the > members of the modules, I could just do it in two places: > the setup() function and the application generating the auto modules > (which isn't necessarily written in python).
This sounds to me like a description of an object oriented design using inheritance and polymorphism. An abstract class that defines a standard set of methods that are called in a generic way which may be substituted at runtime by any one of a number of subclasses each implementing their own specialised version of the generic behaviour. The snag with importing at point of use is that importing a newly created module is one of the slowest things you an do in Python - it has to compile it and then read it and then execute it! If you can load the moules in advance somehow (maybe in a thread?) there might be significant gains... Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor