PEP 810: Explicit lazy imports

I agree this is the best way to explain it.

There’s enough mutable state in the import system that I think the only two viable lazy loading options are "look up the module eagerly without executing it (the LazyLoader approach, which the PEP has good reason not to use), and “don’t eagerly look up anything, not even the value of the __import__ hook” (which is the PEP’s approach, albeit not expressed entirely clearly yet).

3 Likes