lazy imports

Andrew Bennetts andrew.bennetts at canonical.com
Tue Mar 2 00:40:14 GMT 2010


Gordon Tyler wrote:
> I was wondering why the current implementation of lazy imports was used
> instead of something like:
> http://code.activestate.com/recipes/473888-lazy-module-imports/
> 
> The reason I'm asking is that bzr's current style of lazy imports
> prevents code-inspecting editors from recognizing which modules are
> imported in a particular file.

That recipe is much more intrusive.  I'd expect it to cause some bugs,
probably shallow ones, but I doubt it's a 5-minute job to replace ours
with that.  It might also perform worse, because it will proxy so many
more objects (but obviously measurements would be needed to be sure).

Python really needs some sort of lazy import to be builtin, so that it
can work safely, efficiently, *and* be understood by tools like editors.

-Andrew.




More information about the bazaar mailing list