Live data from Hacker News

Python 3.15: features that didn't make the headlines

blog.changs.co.uk

31–40 of 236 posts

Re: Python 3.15: features that didn't make the headlines

#31
post #4

From this example: lazy from typing import Iterator def stream_events(...) -> Iterator[str]: while True: yield blocking_get_event(...) events = stream_events(...) for event in events: consume(event) Do we finally have "lazy imports" in Python? I think I missed this change. Is this also something from Python 3.15 or earlier?

Note that you can work around it by implementing `def __getattr__(name: str) -> object:` at the module level on earlier Python versions

Re: Python 3.15: features that didn't make the headlines

#32

I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot world. Mostly moving to go these days.

Three things I find unlikely about this:

- You wrote 100K lines of code (I've worked on several large C++ projects that were far smaller)

- You wrote those lines in Python (surely the whole point of Python is to write less code)

- You deleted them (never delete anything, isn't this what modern VCS is all about?)

But whatever floats your boat.

Re: Python 3.15: features that didn't make the headlines

#33

Earlier quoted context omitted.

Same, I’m not sure how Python survives this outside of machine learning. All of our services we were our are significantly faster and more reliable. We used Rust, it wasn’t hard to do

the funny thing is that everyone, including myself, posited that python would be the winner of the ai coding wars, because of how much training data there is for it. My experience has been the opposite.

AI benefits from tools to verify its halucinations. That's much easier in a typed and compiled language. Then have a language that can't be monkey patched at runtime and the confidence increases even more.

If you mean "easy to get something out of it" then yeah, it's great.

Re: Python 3.15: features that didn't make the headlines

#34
post #29
post #25

Earlier quoted context omitted.

Empirically, I have used the current accepted way to do lazy imports (import statement inside a function) before AI coding was even a mainstream thing, for personal code that sometimes needs a heavy import and sometimes doesn’t. The lazy statement would be an improvement as it allows one to see all the imports at the top where you expect them to be.

As a now deleted comment pointed out, lazy imports had been requested forever. They were rejected forever and were accepted just when BigCorps wanted them . Python-dev now is paid to shore up the failed Instagram stack.

I too am outraged that a product would prioritize its biggest users.

Re: Python 3.15: features that didn't make the headlines

#35
post #24

Earlier quoted context omitted.

the funny thing is that everyone, including myself, posited that python would be the winner of the ai coding wars, because of how much training data there is for it. My experience has been the opposite.

I felt the opposite, because Python isn’t a great language. It won because of Google, fast prototyping, and its ML interop (e.g. pandas, numpy), but as a language it’s always been subpar. Indentation is a horrible decision (there’s a reason no other language went this way), which led to simple concepts like blocks/lambdas having pretty wild constraints (only one line??) Type decoration has been a welcome addition, bu…

> there’s a reason no other language went this way)

Except of course for those that did, Haskell, Fortran for example.

Re: Python 3.15: features that didn't make the headlines

#37
post #32

I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot world. Mostly moving to go these days.

Three things I find unlikely about this: - You wrote 100K lines of code (I've worked on several large C++ projects that were far smaller) - You wrote those lines in Python (surely the whole point of Python is to write less code) - You deleted them (never delete anything, isn't this what modern VCS is all about?) But whatever floats your boat.

> You deleted them (never delete anything, isn't this what modern VCS is all about?)

The person said: "deleted 100k+ lines this year already moving them to faster languages"

Are you saying that when you move code to another language/rewrite in another language, you leave the original languages code in your repo?

They didn't say they deleted it from their git history. I delete code all the time (doesn't mean its "gone", just that its not in my git head).

Re: Python 3.15: features that didn't make the headlines

#38

Earlier quoted context omitted.

> Python is such a weird language. Lazy imports are a bandaid for AI code base monstrosities with 1000 imports Just because you don’t like a feature doesn’t mean it’s because of AI and bad code.

I think this is just a natural consequence of an easy-to-use package system. The exact same story as with node. If you don't want lots of imports, don't make it so damn easy to pile them into projects. I'm frankly surprised we still see so few supply chain attacks, even though they picked up their cadence dramatically.

This seems a lot more due to an import running arbitrary code because stuff can happen in the top-level of a module rather than only happening in functions. From what I can tell, it seems pretty common for dynamically typed languages and pretty much entirely absent from statically typed ones, which tend to have a main function that everything else happens inside transitively. I guess this makes it easy if what you're writing is something that runs with no dependencies, but it's a pretty terrible experience as soon as you try to introduce the concept of a library.

Re: Python 3.15: features that didn't make the headlines

#39
post #32

I was so into Python for 10 years, was enjoyable to work in. But have deleted 100k+ lines this year already moving them to faster languages in a post AI codebot world. Mostly moving to go these days.

Three things I find unlikely about this: - You wrote 100K lines of code (I've worked on several large C++ projects that were far smaller) - You wrote those lines in Python (surely the whole point of Python is to write less code) - You deleted them (never delete anything, isn't this what modern VCS is all about?) But whatever floats your boat.

Uhm what? All of those things are totally ordinary.

Re: Python 3.15: features that didn't make the headlines

#40

Earlier quoted context omitted.

> Python is such a weird language. Lazy imports are a bandaid for AI code base monstrosities with 1000 imports Just because you don’t like a feature doesn’t mean it’s because of AI and bad code.

I think this is just a natural consequence of an easy-to-use package system. The exact same story as with node. If you don't want lots of imports, don't make it so damn easy to pile them into projects. I'm frankly surprised we still see so few supply chain attacks, even though they picked up their cadence dramatically.

What would your alternative look like?
Post reply on HN