Re: Lazy Imports -- I Like This Idea
Piergiorgio Sartor <[email protected]> Fri, 27 Mar 2026 19:09:49 +0100
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On 26/03/2026 02.40, Lawrence D’Oliveiro wrote: > So Python 3.15 will introduce a new, “lazy” import mechanism > <https://peps.python.org/pep-0810/>. > > So far I have done one script where I moved an import into the > function where it was used, instead of doing it globally; this reduced > the script startup time from around 1.5 seconds down to about a > quarter second. > > “Lazy” imports would avoid the need for such workarounds, while > keeping all imports together so they can be found more easily. Interesting, I needed this as well. Last time I checked, the suggestion was rejected... Good if they changed their mind. bye, -- piergiorgio