[Python-Dev] Listing of PEP 328 status and possible minor oversight (original) (raw)

Brett Cannon brett at python.org
Wed Dec 20 22:45:42 CET 2006


On 12/20/06, Thomas Wouters <thomas at python.org> wrote:

On 12/20/06, Brett Cannon <brett at python.org> wrote: > > I just noticed that PEP 328 (relative imports) is listed as an accepted > PEP, but not completed. Is this because there is still things to do for > 2.6 and 2.7? Or did someone just forget to move it to the completed > PEPs section of the PEP index? If it is the former then PEP 362 will need > to be moved. There was some minor finagling about the wording of the PEP, I think, that I was still supposed to do. Some explanation of common practices, maybe; the python-dev archives might have it. I could never get it into the PEP the right way, the end result was never that big a change (and a bit awkward with the rest.) I also noticed that there is no mention of removing import redirection to > a top-level module by having None in sys.modules. Was this for > backwards-compatibility issues, or was it just not thought of? I don't think I've ever heard of that idea. I don't know what 'import redirection' is either. But maybe it was one of those things that were still supposed to go into PEP 328.

So if sys.modules has an entry of None for a dotted name then import is supposed to stop trying to import that name and instead import a top-level name. This happens if you do import string from within a package and there is no 'string' module there. This leads to sys.modules['pkg.string'] being None and thus redirecting to sys.modules['string']. This is only useful for classic relative import semantics and thus can probably go once absolute imports are the only way to do imports.

-Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20061220/6ddaf348/attachment.htm



More information about the Python-Dev mailing list