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 bronger
Recipients bronger, dcjim, jhylton, loewis, ncoghlan, tim.peters
Date 2008-04-13.08:15:35
SpamBayes Score 0.032162424
Marked as misclassified No
Message-id <1208074536.89.0.777972823887.issue992389@psf.upfronthosting.co.za>
In-reply-to
Content
I dare to make a follow-up although I have no idea at all about the
internal processes in the Python interpreter.  But I've experimented
with circular imports a lot recently.  Just two points:

First, I think that circular imports don't necessarily exhibit a
sub-opimal programming style.  I had a large parser module which I just
wanted to split in order to get handy file sizes.  However, the parser
parses human documents, and layout element A defined in module A may
contain element B from module B and vice versa.  In a language with
declarations, you just include a big header file but in Python, you end
up with circular imports.  Or, you must stay with large files.

So, while I think that this clean error message Nick suggests is a good
provisional solution, it should not make the impression that the
circular import is a flaw by itself.

And secondly, the problem with modules that are not yet populated with
objects is how circular imports have worked in Python anyway.  You can
easily cope with it by not referencing the imported module's objects in
the top-level code of the importing module (but only in functions and
methods).
History
Date User Action Args
2008-04-13 08:15:37brongersetspambayes_score: 0.0321624 -> 0.032162424
recipients: + bronger, tim.peters, loewis, jhylton, dcjim, ncoghlan
2008-04-13 08:15:36brongersetspambayes_score: 0.0321624 -> 0.0321624
messageid: <1208074536.89.0.777972823887.issue992389@psf.upfronthosting.co.za>
2008-04-13 08:15:36brongerlinkissue992389 messages
2008-04-13 08:15:35brongercreate