On 2010-02-04 11:37 AM, Floris Bruynooghe wrote:
On Thu, Feb 04, 2010 at 05:53:16PM +0100, Riccardo-Maria BIANCHI wrote:
Now I can import them as:
package.src.mod1
package.share.mod2

How can I use Distutils to be able to import both of them under the
same "package" namespace as:

import package.mod1
import package.mod2

In package/__init__.py:

import src.mod1 as mod1
import share.mod2 as mod2

And then you can use just one "import package" statement.  If you want
src and share to be separately installable then it gets more
complicated (you'd need namespace packages etc), but why complicated
when simple works?

Because simple doesn't work. You cannot do "import package.mod1" or "from package.mod1 import foo" with that scheme.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to