ncoghlan
(Alyssa Coghlan)
October 5, 2025, 3:32pm
94
Jakub Beránek:
Have you thought about approaching this in the other direction? Add a new keyword for imports that are eager, so that people can express their intent - only a very small number of imports have to be eager, so it would IMO be better to let this specific case be explicit, rather than force users to mark all the other cases and hoping that it will improve perf.
Any proposals that assume that lazy imports will ever become the default fall under the general umbrella of “Rejected when PEP 690 was rejected”:
Decision on PEP 690 - Lazy Imports
The Python Steering Council has decided to reject PEP 690 on Lazy Imports .
We agree with the widely accepted sentiment that faster Python startup time is desirable. Large command line tools in particular suffer as that is a human user experience. Lazy imports, as proposed, are one of many potential mechanisms that can help with that.
But a problem we deem significant when adding lazy imports as a language feature is that it becomes a split in the community…
Since defaulting to eager imports isn’t going to change at this late stage in Python’s history, it’s the non-default lazy imports that get the more verbose syntax.
4 Likes