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 ncoghlan
Recipients brett.cannon, bronger, dcjim, gvanrossum, jhylton, loewis, ncoghlan, tim.peters
Date 2009-04-01.10:38:24
SpamBayes Score 1.7904634e-07
Marked as misclassified No
Message-id <1238582305.71.0.0294301476281.issue992389@psf.upfronthosting.co.za>
In-reply-to
Content
No argument from me that my suggestion is a mere glimmering of an idea,
rather than a fully worked out definitely viable solution.

It was just an angle of attack I hadn't seen suggested before, so I
figured it was worth mentioning - the fact that a module is allowed to
exist in sys.modules while only half constructed is the reason "import
a.b.c" can work while "from a.b import c" or an explicit relative import
will fail - the first approach gets a hit in sys.modules and succeeds,
while the latter two approaches fail because the a.b package doesn't
have a 'c' attribute yet.

Figuring out a way to set the attribute in the parent package and then
roll it back later if the import fails is still likely to be the more
robust approach.
History
Date User Action Args
2009-04-01 10:38:26ncoghlansetrecipients: + ncoghlan, gvanrossum, tim.peters, loewis, jhylton, brett.cannon, dcjim, bronger
2009-04-01 10:38:25ncoghlansetmessageid: <1238582305.71.0.0294301476281.issue992389@psf.upfronthosting.co.za>
2009-04-01 10:38:24ncoghlanlinkissue992389 messages
2009-04-01 10:38:24ncoghlancreate