Message84993
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. |
|
Date |
User |
Action |
Args |
2009-04-01 10:38:26 | ncoghlan | set | recipients:
+ ncoghlan, gvanrossum, tim.peters, loewis, jhylton, brett.cannon, dcjim, bronger |
2009-04-01 10:38:25 | ncoghlan | set | messageid: <1238582305.71.0.0294301476281.issue992389@psf.upfronthosting.co.za> |
2009-04-01 10:38:24 | ncoghlan | link | issue992389 messages |
2009-04-01 10:38:24 | ncoghlan | create | |
|