[issue992389] attribute error after non-from import

Adam Olsen report at bugs.python.org
Mon Aug 31 23:44:39 CEST 2009


Adam Olsen <rhamph at gmail.com> added the comment:

The key distinction between this and a "bad" circular import is that
this is lazy.  You may list the import at the top of your module, but
you never touch it until after you've finished importing yourself (and
they feel the same about you.)

An ugly fix could be done today for module imports by creating a proxy
that triggers the import upon the first attribute access.  A more
general solution could be done with a lazyimport statement, triggered
when the target module finishes importing; only problem there is the
confusing error messages and other oddities if you reassign that name.

----------
nosy: +Rhamphoryncus

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue992389>
_______________________________________


More information about the Python-bugs-list mailing list