On Thu, Jul 23, 2009 at 13:05, Guido van Rossum <gu...@python.org> wrote:

> On Thu, Jul 23, 2009 at 12:09 PM, Fred Drake<fdr...@acm.org> wrote:
> > On Jul 23, 2009, at 2:59 PM, Georg Brandl wrote:
> >>
> >> is the presence of None values in sys.modules considered an
> implementation
> >> detail?  If not, it should be documented what the None values mean to
> the
> >> interpreter.
> >
> > As I recall, they're an optimization.  But since sys.modules is itself
> > documented, and many applications actually use it, I think it's worth
> > explaining that the None values can reasonably be expected, and what they
> > indicate.
>
> They should certainly be documented -- without them imports from
> inside package would be super expensive (at least for Python versions
> where implicit relative import exists). I'm somewhat surprised this
> isn't documented, I don't think I've tried to keep this usage hidden.
> I've also sometimes abused this to force some module to believe that a
> certain other module doesn't exist.
>

It has not been hidden, but the only place I ever came across it was in the
original essay about packages.


>
> OTOH in Py3k I'm not sure that we even *need* them any more, since
> there is no more implicit relative import... They would only speed up
> the raising of ImportError, not the finding of a similar-named module
> elsewhere in the hierarchy.


None in Python 3.1 is really useless in terms of its semantics in relative
imports; importlib doesn't support it and still passes as __import__ (at
least last time I ran the test suite that way). I thought we had agreed a
while back that supporting None was not warranted in Python 3.0? Otherwise I
will do whatever work is necessary for this to happen.

-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