[Python-ideas] Detecting circular imports ?

Ian Bicking ianb at colorstudy.com
Fri Nov 19 18:18:00 CET 2010

On Thu, Nov 18, 2010 at 5:29 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:

> > If you use the "from module import something" form it will be an
> > ImportError. If you do "import module" and then "module.something" you
> will
> > see an AttributeError. These are the ones that can be confusing.
> Yes that's the case I was thinking of. After years of Python I can
> still get trapped on those. But maybe that's just me :)

I certainly have problems with circular imports (especially involving
__init__.py), and (as far as I've noticed) the error messages are seldom
helpful unless you happen to be experienced in the problem and remember to
look for circular imports.  Simply giving a better error message for this
case would solve the problem in my opinion, without the complexity of
actually making anything work that doesn't work now.

Ian Bicking  |  http://blog.ianbicking.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101119/29fae3f5/attachment.html>

More information about the Python-ideas mailing list