top | item 45466562

(no title)

TheMrZZ | 5 months ago

Feels like a good feature, with a simple explanation, real world use cases, and a scoped solution (global only, pretty simple keyword). I like it!

discuss

order

BiteCode_dev|5 months ago

Agree, they really did their homework, listed edge cases, made practical compromises, chose not to overdo it, reworked it again and again quite a bit and compared it to real life experience.

It's really beautiful work, especially since touching the back bone (the import system) of a language as popular as Python with such a diverse community is super dangerous surgery.

I'm impressed.

12_throw_away|5 months ago

Yeah, I think this is one of the cleanest PEPs to come around in quite a while, at least from the userspace perspective. Interested to see what happens after the traditional syntax bikeshedding ritual has been completed.

oofbey|5 months ago

Hopefully they learned lessons from why PEP-690 was rejected. I've spent quite a while trying to build this stuff for our codebase and it's never worked well enough to use.

dahart|4 months ago

690 is mentioned a few times, including a FAQ note on the differences

https://pep-previews--4622.org.readthedocs.build/pep-0810/#f...

Q: How does this differ from the rejected PEP 690?

A: PEP 810 takes an explicit, opt-in approach instead of PEP 690’s implicit global approach. The key differences are:

Explicit syntax: lazy import foo clearly marks which imports are lazy.

Local scope: Laziness only affects the specific import statement, not cascading to dependencies.

Simpler implementation: Uses proxy objects instead of modifying core dictionary behavior.