Live data from Hacker News

Python 3.15: features that didn't make the headlines

blog.changs.co.uk

71–80 of 236 posts

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

#71
post #59

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.

I'm still on the lookout for a comprehensive Django-like web framework for go. That would be an instant hit for me.

Same here. Django is my last holdout for Python. Everything new is go.

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

#72
post #67
post #58

Earlier quoted context omitted.

Your experience doesn't match mine. I have, mostly solo, and part time, written multiple codebases that on that kind of magnitude (it is about the level where it still will fit in one person's head pretty easily IMO). It doesn't take much to reach that kind of size. Now, if all of it was super dense and subtle code, then yeah, that would be a lot, but in my experience that's usually a pretty small part of any given c…

> in my experience that's usually a pretty small part of any given codebase Our experiences differ then. Mine is that almost all of the code I write is directly targeted on the usually quite complex problem I am trying to solve. I don't do boilerplate, for example.

I tend not to have much boilerplate (and write abstractions to avoid it), but I do still find there tends to be a lot of supporting code around the 'difficult bits' (TBH, most of the code I write is supporting a small amount of relatively simple but subtle operations, but such is the nature of embedded software). But different codebases are quite different in this regard: this is why such different scales shouldn't be too surprising in different domains.

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

#73
post #24

Earlier quoted context omitted.

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…

Lambdas are intentionally kneecapped in python because Guido van Robson doesn't want to make a functional language. (As in "functional programming", not that it doesn't work.)

Guido van Rossum didn't oppose functional programming, but he wanted to keep the language (and the interpreter) simple.

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

#74
post #64
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?

What benefit does the lazy import have here - if we use the value in a type hint at module scope anyway? Would that require Deferred evaluation of annotations -- which I don't think are enabled by default?

[dead]

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

#75
post #64
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?

What benefit does the lazy import have here - if we use the value in a type hint at module scope anyway? Would that require Deferred evaluation of annotations -- which I don't think are enabled by default?

Type annotations are lazily evaluated by moving them behind a special annotations scope as of 3.14:

https://peps.python.org/pep-0649/

https://docs.python.org/3/reference/compound_stmts.html#anno...

With 3.15, using lazy typing imports is more or less an alternative to putting such imports behind an "if TYPE_CHECKING" guard.

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

#76

Earlier quoted context omitted.

Typescript wins in terms of training data IMHO, by which I mean that the training data is large enough that AI does great with TS, and the language is (IMHO) superior to Python in many ways. I personally now use a mixture of Typescript and Rust for most things, including AI coding. Its been working quite well. (AI doesn't handle Rust as well as TS, in that the code isn't quite idiomatic, but it does ok)

It turns out that volume of training data isn't the most important thing. Elixir beats Kotlin and C#, which beat pretty much everything else. Kotlin is probably the sweet spot for most things.

Not the most important thing, but it certainly helps.

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

#77
post #50

Earlier quoted context omitted.

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

Well, they deleted it from somewhere. As I assumed they were using a VCS I assumed they deleted it from that. Or are they really short of disk space?

Deleted from the current head/trunk of the repo, ie the deployed code.

Deleting "from my codebase" doesn't imply deleting it from history or backups. Just that the code isn't present for future edits or deployments.

The way you're talking, it sounds like you never delete code from your codebase. Do you just comment it out when you change a line to something else or replace a function with a new one? Just add new files?

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

#78
post #75
post #64

Earlier quoted context omitted.

What benefit does the lazy import have here - if we use the value in a type hint at module scope anyway? Would that require Deferred evaluation of annotations -- which I don't think are enabled by default?

Type annotations are lazily evaluated by moving them behind a special annotations scope as of 3.14: https://peps.python.org/pep-0649/ https://docs.python.org/3/reference/compound_stmts.html#anno... With 3.15, using lazy typing imports is more or less an alternative to putting such imports behind an "if TYPE_CHECKING" guard.

Ah, thanks for the update. My only check before asking was to check if the future feature for annotations had been enabled by default yet. It has then effectively been abandoned instead, I guess.

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

#79
post #24

Earlier quoted context omitted.

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…

I’m always baffled when language complaints come down to syntax

That’s exactly how I think, too. But at the same time, I like indentation in Python, because I would logically indent in every other language as well. In fact, I find all those semicolons and similar things at the end of each line completely redundant (why should I repeat myself for something the compiler should do) and I hate them. And that’s despite having experience with Modula and 10 years of C++. But when I look at Rust, I find the syntax simply awful. From an ADHD perspective…

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

#80

Earlier quoted context omitted.

Interested in why you'd use Python in the first place? Advice for someone who knows nothing about programming - what would you suggest?

IMO the main reasons people use Python are: 1. The very first steps are quite simple. Hello world is literally just `print("hello world")`. In other languages it can be a lot more complex. 2. It got a reputation as a beginner-friendly language as a result. 3. It has a "REPL" which means you can type code into a prompt and it will execute it interactively. This is very helpful for research (think AI) where you're tryi…

ptpython has existed for a decade, maybe two, and python is high level, more readable than most languages. Exec speed hasn’t mattered in my near thirty years of using it for business and prototyping tasks which it promoted early.

Yes it strains at the big to huge project end, not recommended to take it there. Still there are better tools to help now.

Post reply on HN