[Python-ideas] Detecting circular imports ?

Stephen J. Turnbull stephen at xemacs.org
Fri Nov 19 05:32:24 CET 2010

Tarek Ziadé writes:

 > 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 :)

So you're suggesting (pseudo-code, not Python!)

    message = usual_message
    if object is instance of ModuleType:
        message += "\nreferenced object is a module; are your imports OK?"
    raise AttributeError(message)

or something like that?

More information about the Python-ideas mailing list