Nested packages and import order bug

  • Thread starter Joerg Sonnenberger
  • Start date
J

Joerg Sonnenberger

Hi all,
I have a package a.b with the following content:

a/b/__init__.py:
import a.b
dir(a.b)

Running "import a.b" generates an AttributeError for b, obviously
the import didn't add b to the module "a". Even though it can be
argued that importing a package from within is bad style, this
a clearly a bug since its at least surprising.

Shouldn't the import create the namespace entry in a after it
created the module entry in sys.modules?

Therefore should I submit a bug report?

Joerg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top