[Python-ideas] Detecting circular imports ?

Georg Brandl g.brandl at gmx.net
Thu Nov 18 16:41:35 CET 2010

Am 18.11.2010 16:22, schrieb Antoine Pitrou:
> On Thu, 18 Nov 2010 16:14:35 +0100
> Tarek Ziadé <ziade.tarek at gmail.com> wrote:
>> 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.
> It can't be an error, since circular imports are supported.
> There could be a warning, but IMO it would need to be silenced by
> default (which means ImportWarning isn't appropriate).

I thought ImportWarning was silenced by default?

Anyway, I don't think that would be helpful for developers, who would
need to turn on the warnings explicitly to see them.  But to think of
that, you already need to suspect circular imports, and then it's easy
to see it from the traceback anyway.


More information about the Python-ideas mailing list