Nick Coghlan wrote:
On Fri, Nov 19, 2010 at 11:15 PM, Nick Coghlan email@example.com wrote:
Feel free to take a shot at it - the relevant bug report  is only a little over 6 years old! :)  http://bugs.python.org/issue992389
Less facetiously, there are 3 different things suggested in that bug report that people could try:
- Implement the set-and-rollback feature for submodule attributes in
parent packages during import 2. Implement the "try looking for the fully qualified name in sys.modules" idea(/hack) 3. Track in-progress imports and throw specific errors if the import code trips over one
The last option does have the advantage of requiring less coordination with the developers of other implementations (given the subtleties of this issue, I'd want feedback from at least PyPy, IronPython and Jython as to what they can handle before we started messing with the semantics of what the language allows as far as circular imports go)
The issue suffers from the fact that at least some of the people with the knowledge to do something about it are not inclined to do so due to strong stylistic objections (*ahem*).
How would the implementation differentiate between a real attribute error (missing symbol while setting up a module) and one caused by a circular import (symbol available, but not yet defined) ?