Live data from Hacker News

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

discuss.python.org

11–20 of 64 posts

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

#12

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 :)

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

Yes. It is much more clear to be explicit though.

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

#14
post #13

Does it conform Occam's razor rule to have something that can be easily done very similar way without changing language?

Having some limited experience with lazy imports, yes, but this eliminates a lot of gross boilerplate. It also has the effect of "blessing" the practice of lazy imports which can have a cultural impact; it also prevents a situation wherein multiple subtly incompatible approaches to lazy imports become individually popular.

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

#15

I've noticed that instead of defining requires at the top of Lua files, if you can know your own program well enough, defining them right before the dependency is actually used makes large Lua programs much, much quicker. Generally speaking, startup times can be a sped up by a meaningful factor. I suspect this change in Python will dramatically improve the performance of such large programs as well.

> 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.

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

#16

I've noticed that instead of defining requires at the top of Lua files, if you can know your own program well enough, defining them right before the dependency is actually used makes large Lua programs much, much quicker. Generally speaking, startup times can be a sped up by a meaningful factor. I suspect this change in Python will dramatically improve the performance of such large programs as well.

You have always been able to do the same thing in Python. This PEP isn't needed for that functionality.

You can declare imports at the beginning of a program that don’t load until they are used?

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

#18
post #13

Does it conform Occam's razor rule to have something that can be easily done very similar way without changing language?

Not sure that's Occam's razor any more.

Regardless lazy loading needs widespread use to be most effective so having a unified syntax and no extra dependencies makes a lot of sense.

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

#19

Some folks at HRT[0] will probably be unhappy about that lol 0. https://www.hudsonrivertrading.com/hrtbeat/inside-hrts-pytho...

Why would they? The accepted PEP just has extra keywords to mark imports explicit. That's a source level find-and-replace. They already did most of the real work in their codebase, such as finding where the code depended on the side effect of importing a module.

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

#20

Some folks at HRT[0] will probably be unhappy about that lol 0. https://www.hudsonrivertrading.com/hrtbeat/inside-hrts-pytho...

I'm confused, wouldn't HRT be happy about this? The article you linked specifically states "..we hope to propose a revised lazy imports PEP that introduces an explicit lazy keyword.."

Is that not exactly what PEP 810 proposes?

Post reply on HN