[Python-Dev] import problems (original) (raw)

Mart Somermaa mrts at mrts.pri.ee
Sun Nov 30 14:02:16 CET 2008


Brett Cannon wrote:

The old-hands on python-dev know this is where I plug my import rewrite vaporware. It will be in 3.1, and as part of it there will be a new API for handling direct imports. Jacob Kaplan-Moss and I have

Sounds good. I can finally rest in peace :) . May I suggest that you disable the hack while you are at it as well so that people will be aware of their misdoings?

talked about Django's need for this as PyCon so I am very aware of needing this API and it will be addressed in the simplest way possible (heck, the import API might actually become a wrapper around the simpler API in the end).

Even better (the bracketed part).

And since nothing can go into 3.0 anyway, there is no need to rush into solving this right now.

Agreed, I just wanted to get the ball rolling.

Let me know if you want me to do some gruntwork (tests, documentation) once the improved implementation is taking shape.


As for the other comments, I'll try to wrap things up:


It looks that the

import(modname) mod = sys.modules[modname]

idiom is the clear winner for the import submodule use case. I've updated http://bugs.python.org/issue4457 with proposed additions to current import docs. Once the simpler interface emerges, the docs should be updated again and import use should be discouraged.



More information about the Python-Dev mailing list