How to pass parameter when importing a module?

Swaroop C H swaroopch at gmail.com
Sun Mar 20 11:43:10 EST 2005


On Sun, 20 Mar 2005 10:18:14 -0600, Bo Peng <bpeng at rice.edu> wrote:
> 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 *

Suggestion: Maybe you use builtin `__import__` to load a module ? Note
that in this way, you'll have to use the module name prefix.


-- 
Swaroop C H
Blog: http://www.swaroopch.info
Book: http://www.byteofpython.info



More information about the Python-list mailing list