Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Nested packages and import order bug

Reply
Thread Tools

Nested packages and import order bug

 
 
Joerg Sonnenberger
Guest
Posts: n/a
 
      10-06-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Packages : A loomingproblem? packages might no longer work? (well not on your platform or python version anyway) David Lyon Python 19 04-23-2009 11:10 PM
import order or cross import Roland Hedberg Python 5 01-03-2007 11:25 PM
Advice on converting hashed packages to pseudo-hashed packages Ian Perl Misc 3 02-12-2005 12:17 AM
Do the javax.imageio packages replace packages in com.sun.image? Paul Smith Java 0 11-18-2003 02:58 PM



Advertisments