On 12/20/06, Thomas Wouters <[EMAIL PROTECTED]> wrote:



On 12/20/06, Brett Cannon <[EMAIL PROTECTED]> 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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to