Jean-Marc Orliaguet wrote:
Jim Fulton wrote:

yes indeed, but no "cross" imports between packages that are siblings.

Huh? Why? I'm not at all sure I know what you mean.

the question is what relation between the importer and the imported are OK: if I add such imports in, I should only import from packages located in the same folder or in subfolders but not from sibling folders or from parent folders.

Ah. Right. Agreed.

with a directory structure like:


- packageA
 |__ packageB

- packageC

in it is OK  to add:

   from root.packageA.somefile import somemodule

to make it possible for external packages to import "somemodule" as:

   from root.packageA import somemodule

it is OK to write in :

   from root.packageA.packageB.somefile import someothermodule

to import it as:

   from root.packageA import someothermodule

but it is not OK to put the same imports in packageC (a sibling), which be some sort or cross import between packages that are not parent / child to one another. This easily leads to circular imports.

so what I mean is : parents import from children to make it possible for external packages to import directly from the parents.



Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714  
Zope Corporation
Zope3-dev mailing list

Reply via email to