[issue33547] Relative imports do not replace local variables

R. David Murray report at bugs.python.org
Fri May 18 17:43:28 EDT 2018


R. David Murray <rdmurray at bitdance.com> added the comment:

It's the same answer.  __init__ *is* the package namespace, so you are setting the value of 'func' in the package (.) namespace, and what import is doing is correct.

I know this is confusing.  I banged my head against it while debugging a weird import problem in the anydb module, but it is working as designed.  I think the way __init__ works may fall under rule 14 of the Zen :)

----------
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33547>
_______________________________________


More information about the Python-bugs-list mailing list