Message199323
I believe that this is because once you execute the first line, 'a' exists as a name in the 'lib' namespace, so 'from . import a' sees that 'a' already exists, and does nothing. The same import sequence in abc.py will put 'a' into the 'abc' namespace, but 'from . import a' will be looking in the 'lib' namespace, won't see an 'a', and will do the new import, overwriting the definition of 'a' in the 'abc' namespace as it does so.
The exact effects of imports inside __init__ is sometimes a bit non-intuitive. |
|
Date |
User |
Action |
Args |
2013-10-09 18:28:19 | r.david.murray | set | recipients:
+ r.david.murray, ethan.glasser.camp |
2013-10-09 18:28:19 | r.david.murray | set | messageid: <1381343299.58.0.0851639203166.issue19211@psf.upfronthosting.co.za> |
2013-10-09 18:28:19 | r.david.murray | link | issue19211 messages |
2013-10-09 18:28:19 | r.david.murray | create | |
|