On Tue, Feb 7, 2012 at 16:19, Paul Moore <p.f.mo...@gmail.com> wrote:

> On 7 February 2012 20:49, Antoine Pitrou <solip...@pitrou.net> wrote:
> > Well, import time is so important that the Mercurial developers have
> > written an on-demand import mechanism, to reduce the latency of
> > command-line operations.
>
> One question here, I guess - does the importlib integration do
> anything to make writing on-demand import mechanisms easier (I'd
> suspect not, but you never know...) If it did, then performance issues
> might be somewhat less of a sticking point, as usual depending on use
> cases.


Depends on what your feature set is. I have a fully working mixin you can
add to any loader which makes it lazy if you trigger the import on reading
an attribute from the module:
http://code.google.com/p/importers/source/browse/importers/lazy.py . But if
you want to trigger the import on *writing* an attribute then I have yet to
make that work in Python source (maybe people have an idea on how to make
that work since __setattr__ doesn't mix well with __getattribute__).
_______________________________________________
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