Re: latest update of PEP 451

Brett Cannon <[email protected]> Thu, 26 Sep 2013 15:15:16 -0400
Newsgroups gmane.comp.python.import
Message-ID <CAP1=2W7RBM_uzXD6fJs=wV4pcbz4o_sV21LKnkbUy1R=6qPKfw@mail.gmail.com>
On Thu, Sep 26, 2013 at 3:02 PM, Eric Snow <[email protected]>wrote:

> On Sep 25, 2013 7:05 AM, "Brett Cannon" <[email protected]> wrote:
> > On Wed, Sep 25, 2013 at 1:46 AM, Eric Snow <[email protected]>
> wrote:
>

[SNIP]

>  >> .. [lazy_import_concerns]
> https://mail.python.org/pipermail/python-dev/2013-August/128129.html
> >
> >
> > I should mention that this PEP will actually improve the situation for
> lazy loading compared to how it is in Python 3.3 when using
> __getattribute__. Because import now tries to backfill attributes like
> __package__ and __loader__, any module that is lazy based on attribute
> access automatically gets loaded by import itself. But with this PEP we can
> change import's semantics to not do that with spec-loaded modules and thus
> loader.exec_module() can insert a lazy module into sys.modules and know
> that it's attributes won't be touched unless you do a ``from ... import``
> on it.
>
> Yeah, I'm mostly focused on addressing concerns.  Would a lazy load
> example be worth adding to the PEP?
>

If it you don't think it will detract from the rest of the PEP it wouldn't
hurt. If you want I can write up some rough code to demonstrate how it
would work.

_______________________________________________
Import-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/import-sig