Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: Lazy Imports -- I Like This Idea Date: Sun, 29 Mar 2026 19:03:12 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: <87qzp2axb3.fsf@nightsong.com> References: <10q22pv$2f060$2@dont-email.me> <10qc9fp$1v9oe$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 30 Mar 2026 02:03:13 +0000 (UTC) Injection-Info: dont-email.me; posting-host="d69515f92b647dbed8d41357eb2fa156"; logging-data="2196447"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HDp0Hrzj/o/K69M9cGvRk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:udZljRUG4s+9BZSrZw5nZBOp+VU= sha1:AOfxevjMPesCD5v+9GTmvSt53Bo= Xref: csiph.com comp.lang.python:197752 Lawrence D’Oliveiro 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.