This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cool-RR
Recipients brett.cannon, brian.curtin, cool-RR, eric.araujo, eric.snow, r.david.murray
Date 2011-07-20.07:29:54
SpamBayes Score 1.783176e-07
Marked as misclassified No
Message-id <1311146995.44.0.0399538854067.issue12583@psf.upfronthosting.co.za>
In-reply-to
Content
David, I don't think you've read my message carefully enough. I'm well aware that there are other ways in Python to import than the `import` statement. I'm proposing that it doesn't matter.

I asked, "isn't a circular import when you try to import a module `foo` while in a lower stack level you haven't finished importing `foo` yet?" If this is true, then you just need to have some kind of flag for each module saying "This module is currently being imported", which you set to `True` when you start importing and back to `False` when you finished importing. (It doesn't have to look exactly like this, it could be a context manager, or alternatively a centralized list of all module that are currently in the middle of an import.) Then when you have an `ImportError`, you check whether the module that the user tried to import has that flag raised, and if so notify him that it's probably a circular import problem.

Will that work?
History
Date User Action Args
2011-07-20 07:29:55cool-RRsetrecipients: + cool-RR, brett.cannon, eric.araujo, r.david.murray, brian.curtin, eric.snow
2011-07-20 07:29:55cool-RRsetmessageid: <1311146995.44.0.0399538854067.issue12583@psf.upfronthosting.co.za>
2011-07-20 07:29:54cool-RRlinkissue12583 messages
2011-07-20 07:29:54cool-RRcreate