[Python-Dev] intra-package mutual imports fail: "from <pkg> import <mod>"

David Goodger goodger@users.sourceforge.net
Sun, 02 Jun 2002 12:19:39 -0400

Matthias, thank you for your explanation.  I was operating under the
assumption that the mechanism behind "from package import module" was
somehow different from that behind "from module import name", because there
is no name "module" inside package/__init__.py.  A little experimentation
confirmed that it was a mistaken assumption.  Now all is clear.

The note in section 6.12 ("The import statement") of the Language Reference,
"XXX Can't be bothered to spell this out right now", has always bothered me.
I will endeavour to flesh it out for release 2.3.  Perhaps Guido's package
support essay (http://www.python.org/doc/essays/packages.html), edited,
should form a new section or appendix.  Ideas anyone?

David Goodger  <goodger@users.sourceforge.net>  Open-source projects:
  - Python Docutils: http://docutils.sourceforge.net/
    (includes reStructuredText: http://docutils.sf.net/rst.html)
  - The Go Tools Project: http://gotools.sourceforge.net/