On Thu, Nov 18, 2010 at 9:14 AM, Tarek Ziadé <ziade.tarek@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