need clarification with import statements

Tool69 kibleur.christophe at gmail.com
Fri Dec 15 06:56:55 EST 2006


Hi John,
> 1. Your directory/package hierarchy is far too complicated. Flatten it.

Ok.

> 2. You have circular references: the others module will import from
> utils, but utils wants to import from others. This is prima facie
> evidence that your modules are not structured properly

Yes, that's why I asked the question in fact, circular references are a
bit hazardous.

>. Rule 1: Modules should contain /related/ classes and functions.
> Rule 2: A graph of what imports what should not have loops.
>
> Consider combining others and utils -- does that make sense?

Yes, I can combine them as they need eachother.

> Another alternative: split out those "some functions of myutils.py (ie
> myutils_func1 and myutils_func2)" into a fourth module. This module
> might be the nucleus of a tool-kit of miscellaneous functions that you
> might import in /any/ app -- in that case, move it outside the current
> package.

Good idea indeed,
Thanks for all,
6TooL9




More information about the Python-list mailing list