Parametrized module import

Jacek Generowicz jacek.generowicz at cern.ch
Thu Jul 8 09:43:31 CEST 2004


I have a module whose behaviour needs to be configurable. The module
needs to decide, the first time it is imported, beteween alternative
interfaces it presents.

Currently, I set some environment variables which select the desired
behaviour, and the module inspects those variables to determine the
mode in which it should set itself up. I would prefer a pure Python
solution, rather than one which depends on external state.

Can you recommend any approaches, or warn against the pitfalls of some
approaches?




More information about the Python-list mailing list