Re: Lazy Imports -- I Like This Idea

Paul Rubin <[email protected]> Sun, 29 Mar 2026 19:03:12 -0700
Newsgroups comp.lang.python
Organization A noiseless patient Spider
Message-ID <[email protected]>
Lawrence D’Oliveiro <[email protected]> writes:
> I don’t think it will be needed for a great many modules. In my case,
> it was only ever an issue with matplotlib.

I defer importing bs4 sometimes, depending on what I'm doing.

What we really need is a way to dump out a loadable image after doing
all the imports, so you can reload your app with almost no import lag.
Lisps have supported that since our grandparents' era.  Emacs still has
something like it (they gave up on the classic unexec though), and
gforth has something similar too.

Maybe CRIU could be adapted for this purpose.