(original) (raw)
On Tue, Feb 7, 2012 at 16:19, Paul Moore <p.f.moore@gmail.com> wrote:
On 7 February 2012 20:49, Antoine Pitrou <solipsis@pitrou.net> wrote:One question here, I guess - does the importlib integration do
> 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.
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\_\_).