Nested packages and import order bug

Discussion in 'Python' started by Joerg Sonnenberger, Oct 6, 2003.

  1. 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
     
    Joerg Sonnenberger, Oct 6, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul  Smith
    Replies:
    0
    Views:
    748
    Paul Smith
    Nov 18, 2003
  2. Roland Hedberg

    import order or cross import

    Roland Hedberg, Jan 3, 2007, in forum: Python
    Replies:
    5
    Views:
    371
    Gabriel Genellina
    Jan 3, 2007
  3. David Lyon
    Replies:
    19
    Views:
    606
    David Lyon
    Apr 24, 2009
  4. Replies:
    7
    Views:
    109
    Matt Garrish
    Jan 10, 2005
  5. Ian
    Replies:
    3
    Views:
    187
Loading...

Share This Page