[Python-ideas] Detecting circular imports ?

Ian Bicking ianb at colorstudy.com
Thu Nov 18 16:36:13 CET 2010


On Thu, Nov 18, 2010 at 9:14 AM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:

> This morning I tried to fix an issue for a while before I realized I
> had a circular import. This issue is not obvious because you get a
> cryptic error, like an AttributeError and it can tak a while before
> finding out.
>
> I don't know of this was mentioned before, or how hard it would be.
> But it would be nice if Python had a specific "CircularImportError"
> raised in that case, or something..
> That would be a fabulous hint for developers.
>

Maybe more specifically, a module could be marked as "loading" in some
fashion, until it's been completely executed.  Any AttributeError from a
loading module would instead raise something like CircularImportError
(subclassing AttributeError).

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


More information about the Python-ideas mailing list