Package organization

Fredrik Lundh fredrik at pythonware.com
Tue Dec 16 04:56:34 EST 2003


Robert Ferrell wrote:

> > Also, because you're importing something from inside a module using the
> > "from" style imports you're risking running into circular reference
> > problems. In my experience from imports are best avoided, unless you're
> > importing a module from a package.
>
> I don't understand this comment.  How does "from" style importing
> increase the risk of circular imports?

python has no problem doing circular (or recursive) imports, but you're likely
to run into problems if you're doing recursive imports and you're referring to
stuff from one module on the *module-level* in another module.  from-import
does exactly that.

for a diskussion, see the section on "recursive imports" on this page:

    http://www.effbot.org/zone/import-confusion.htm

</F>








More information about the Python-list mailing list