# PEP 810: Explicit lazy imports

**URL:** <https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131>\
**Category:** PEPs\
**Created:** [October 3, 2025, 11:50am UTC](https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131 "2025-10-03T11:50:19Z")\
**Posts on this page:** 1\
**Showing post:** 65

<div class="post-metadata">

**Author:** ![brettcannon](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brettcannon/32/34895_2.png) [@brettcannon](https://discuss.python.org/u/brettcannon)\
**Post date:** [October 3, 2025, 9:27pm UTC](https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131/65 "2025-10-03T21:27:25Z")

</div>

I was ~~told~~ asked at the core dev sprints to comment due to spending way too much time thinking about this as the author of importlib and `importlib.util.LazyLoader`. Basically I like it and support it!

I honestly only have a couple of comments about flow in the PEP and one misunderstanding.

> it is useful to provide a mechanism to activate or deactivate lazy imports at a global level.

This is the first mention of the global on/off mechanism, and it’s after emphasizing how `lazy import` is local. It probably could either use more details or just a “more later” comment.

> will check the global lazy imports flag

First mention of the flag with no context.

> the lazy imports filter

First mention of the filter with no context.

> ImportError: deferred import

This is a terminology flip from “lazy” to “deferred”. For consistency it’s probably best to use the same term as the keyword in the exception message (I leave it to the PEP authors which term to choose 😉).

> No ongoing performance penalty unlike importlib.util.LazyLoader.

This assertion is made twice in the PEP and it’s actually incorrect. `LazyLoader` replaces ` __class__ ` for the module so that ` __getattribute__ ` gets changed to `ModuleType` (or whatever `loader.create_module()` returns so there is no perpetual performance penalty:

> <https://github.com/python/cpython/blob/1ae92503647328544866f9586f57eec285e1949a/Lib/importlib/util.py#L179>

The key benefit of this PEP over `LazyLoader` is:

- It doesn’t require wrapping import machinery to make it work.
- It makes finding the module lazy (`LazyLoader` is eager in finding the module but lazy for loading).
- It works on submodules.

---

_[View the full topic](https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131)._
