Re: Lazy Imports -- I Like This Idea

Lawrence D’Oliveiro <[email protected]> Sun, 29 Mar 2026 22:35:37 -0000 (UTC)
Newsgroups comp.lang.python
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Sun, 29 Mar 2026 13:49:09 GMT, Gilmeh Serda wrote:

> From the initial idea I got that now we have to have the word lazy
> scattered all over the place for every module that needs to be
> loaded in such a manner:
>
> lazy import blah
> lazy import whatever
> lazy from thisorthat import meh
>
>
> Wouldn't it have been better if they used, e.g. "with" as a starter?
> Like so:
>
> with lazy:
>     import blah
>     import whatever
>     from thisorthat import meh
>
> Then it would have been much smoother to handle.

I don’t think it will be needed for a great many modules. In my case,
it was only ever an issue with matplotlib.