combining namespaces when importing two modules
Fredrik Lundh
fredrik at pythonware.com
Mon Aug 22 17:16:34 EDT 2005
Donnal Walter wrote:
>I would like to be able to write something like:
>
> import dcw as dw
> import xyz as dw
>
> such that the 'dw' namespace includes definitions from both dcw and xyz,
> but in the script above names from dcw1 are lost. How can I combine the
> two? (I'd rather not use 'import *'
why not? it's designed to make it easy to merge namespaces, so
why not use it?
$ more dw.py
from dcw import *
from xyz import *
$ more myscript.py
import dw
...
</F>
More information about the Python-list
mailing list