Live data from Hacker News

Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

discuss.python.org

31–40 of 64 posts

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#32

Earlier quoted context omitted.

> I suspect this change in Python will dramatically improve the performance of such large programs as well. Makes packaging super fun too, where you need to hit every possible path so you don't miss anything imported in 1% of the execution paths :)

I can't even express how negatively I feel about build/packaging systems that process dependencies based on code-level imports instead of some explicit build manifest separate to the code.

Not to mention the potential for runtime errors long after the code has started up.

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#34

Python is quickly turning into a crowded keyword junkyard

It is a 'soft keyword' as the PEP explains. I would not think that this has any major impact on anyone who just chooses to ignore this feature. Assuming that you want this behavior, I wonder how this could have been done in a better fashion without now having 'lazy' in the specific context of an import statement.

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#35

Python is quickly turning into a crowded keyword junkyard

Python has about 40 keywords, I say I would regularly use about 30, and irregularly use about another 5. Hardly seems like a "junkyard".

Further, this lack of first class support for lazy importing has spawned multiple CPython forks that implement their own lazy importing or a modified version of the prior rejected PEP 690. Reducing the real world need for forks seems worth the price of one keyword.

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#37
post #30

Earlier quoted context omitted.

Can't you do some kind of static analysis instead?

Depends if your code has horrors like this lurking in it: m = importlib.import_module(requests.get("http://localhost:8000/package_name").content.strip().decode("ASCII"))

If you want even better nightmares, you can make localhost:8000 forward to a container running claude code with --dangerously-skip-permissions which uses an unkindness of mcp servers to control that endpoint on the fly based (amongst other sources) on 4chan's /b/.

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#38
post #30

Earlier quoted context omitted.

Can't you do some kind of static analysis instead?

Depends if your code has horrors like this lurking in it: m = importlib.import_module(requests.get("http://localhost:8000/package_name").content.strip().decode("ASCII"))

Since this should be a rare thing I don't think it's unreasonable to require users of patterns like this to put some kind of special annotation for that static analysis tool saying "it may not look like it but I'm doing an import here".

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#39
post #34

Python is quickly turning into a crowded keyword junkyard

It is a 'soft keyword' as the PEP explains. I would not think that this has any major impact on anyone who just chooses to ignore this feature. Assuming that you want this behavior, I wonder how this could have been done in a better fashion without now having 'lazy' in the specific context of an import statement.

soft keyword for anyone not familiar like I was ...

"A new soft keyword lazy is added. A soft keyword is a context-sensitive keyword that only has special meaning in specific grammatical contexts; elsewhere it can be used as a regular identifier (e.g., as a variable name). The lazy keyword only has special meaning when it appears before import statements..."

Re: Python Steering Council unanimously accepts "PEP 810, Explicit lazy imports"

#40
post #2

I think HN is translating the link somehow? It should be directing to this post: https://discuss.python.org/t/pep-810-explicit-lazy-imports/1... """ Dear PEP 810 authors. The Steering Council is happy to unanimously [4 votes, as Pablo cannot vote] accept “PEP 810, Explicit lazy imports”. Congratulations! We appreciate the way you were able to build on and improve the previously discussed (and rejected) attempt at laz…

HN is using the canonical URL for the page. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes...

so it's a misconfig on python.org side?
Post reply on HN