Message167742
The language reference is clear:
"The from form does not bind the module name" (Section 6.12)
However, consider the following example:
* package/__init__.py:
foo = "FOO"
from .foo import bar
print(foo)
os = "OS"
from os import path
print(os)
* package/foo.py:
foo = 42
Now "import package" results in printing:
<module 'pypackage.foo' from 'pypackage/foo.py'>
OS
i.e., the relative "from ... import" has not only bound "bar", but also "foo", which seems to contradict the documentation.
(I get the same behaviour using 3.2.3 as well as 2.7.3.) |
|
Date |
User |
Action |
Args |
2012-08-09 00:18:12 | Antony.Lee | set | recipients:
+ Antony.Lee |
2012-08-09 00:18:08 | Antony.Lee | set | messageid: <1344471488.35.0.495705727003.issue15598@psf.upfronthosting.co.za> |
2012-08-09 00:18:07 | Antony.Lee | link | issue15598 messages |
2012-08-09 00:17:59 | Antony.Lee | create | |
|