A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038545.html below:

[Python-Dev] nested packages and import order

[Python-Dev] nested packages and import order [Python-Dev] nested packages and import orderJoerg Sonnenberger joerg at britannica.bec.de
Mon Oct 6 08:48:10 EDT 2003
Hi all,
I have a package a.b with the following content:

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

Running this generates a 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? 

Joerg

P.S.: Please CC me, I'm not subscriped

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4