How to pass parameter when importing a module?
André Roberge
andre.roberge at gmail.com
Sun Mar 20 12:26:13 EST 2005
Bo Peng wrote:
> Dear list,
>
> What I would like to do is something like:
>
> In myModule.py ( a wrapper module for different versions of the module),
>
> if lib == 'standard':
> from myModule_std import *
> elsif lib == 'optimized'
> from myModule_op import *
>
> but I do not know how to pass variable lib to myModule.py to achieve the
> following effect:
>
How about this:
#===== constants.py
lib = whatever #assigned somewhere else
#===== myModule.py
from constants import lib
etc.
André
More information about the Python-list
mailing list