6 ms·
Python 3.15: features that didn't make the headlines
- brianwawok 6mo agoI 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.
- shankysingh 6mo agoThats very intersting, If I may ask was it from professional projects or personal projects?
- mountainriver 6mo agoSame, 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
- prodigycorp 6mo agothe 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.
- lexicality 6mo agoa lot of the training data is either for python 2 or just generally very low quality
- stuaxo 6mo agoThe quality issue doesn't seem unique to Python. The versioning issue I've seen across libraries that version change in many languages. I don't tend to hit Python 2 issues using LLMs with it, but I do hit library things (e.g. Pydantic likes to make changes between libraries - or loads of the libraries used a lot by AI companies).
- bigfudge 6mo agoI’ve found recent Claude to be much better in this regard. I think a lot rests on the quality of the harness and the work behind the scenes done to RAG up to date docs or search for docs proactively rather than guessing. I also don’t have issues with quality of Python generated. It takes a bit of nudging to use list comps and generators rather than imperative forms but it tends to mimic code already in context. So if the codebase is ok, it does do better.
- prodigycorp 6mo agoThat could be it. I still see LLMs fail a set of static typing challenges that I created a couple years ago as a benchmark. Google models still fail it. I wonder if the lack of typing in a lot of the training data makes python harder to reason about?
- lsbehe 6mo agoThe tons of python code would be great training data if there was any consistency across the ecosystem. Yet every project I've touched required me to learn it's unique style. Then I'd imagine they practically poisoned half the training set because python2 is subtly different.
- tyre 6mo agoI 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, but too slowly iterated on and the native implementations (mypy) are horribly slow at any meaningful size. Concurrency was never good and its GIL+FFI story has boxed it into a long-term pit of sadness. I’ve used it for years, but I’m happy to see it go. It didn’t win because it was the best language.
- groundzeros2015 6mo agoI’m always baffled when language complaints come down to syntax
- Ringz 6mo agoThat’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…
- eager_learner 6mo agofellow ADHD here. Rust feels like 'oh come on you want me to type all that?' I find Raku great, though
- krupan 6mo agoNot ADHD but 100% agree on rusts syntax. It's totally repulsive to me.
- krupan 6mo agoHave you never tried to read someone else's Perl code? Syntax matters. But complaining about indentation is silly. Other languages' compilers don't require it like python does, but the humans using those languages all absolutely require proper indentation. Why not make it part of the language?
- rplnt 6mo agoAI 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.
- nostrebored 6mo ago[dead]
- dkersten 6mo agoTypescript 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)
- CuriouslyC 6mo agoIt 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.
- dkersten 6mo agoNot the most important thing, but it certainly helps.
- eager_learner 6mo ago"sweet spot for most things." care to expand on this a bit? Thanks.
- CuriouslyC 6mo agoKotlin has the combination of JVM ecosystem, overall good performance and agents are good at writing it. I'd argue that it's a better default choice to reach for when working on non-frontend code than Go, though Rust and Python still have use cases.
- eager_learner 6mo agoThanks, that makes sense. I agree.
- eager_learner 6mo agoUpvoted you, because the downvotes from the Python cult are unfair.
- za3faran 6mo agoI wouldn't be surprised if static typing had something to do with it.
- LtWorf 6mo agoYou can test on the device directly, without needing to recompile to try something.
- deleted 6mo ago[deleted]
- deleted 6mo ago[deleted]
- ActorNightly 6mo ago[dead]
- amelius 6mo ago> We used Rust The problem with Rust is that you have to rethink your memory management architecture. I think Go is an easier choice.
- anthk 6mo agoProlog and Lisp will survive because contrary to LLM they know what reproducibility means instead of what LLM's slop around were by design they are stacking errors over time. AI can't compete against the classical AI where both Prolog and Lisp have tons of experience on contraint logic programming and expert systems. With AI you can throw up tons of RAM and VRAM (> $12000) and yet proper designs with Prolog with outperform these by a huge gap.
- deleted 6mo ago[deleted]
- physicsguy 6mo agoGo is terrible for scientific/ML work though, the libraries just aren't there. The wrapping C API story is weak too even with LLMs to assist. Try and write a signal processing thing with filters, windowing, overlap, etc. - there's no easy way to do it at all with the libraries that exist.
- LtWorf 6mo agoI think the purpose of go is to write CRUD. Stray from that and you're on your own.
- zem 6mo agocrud is a pretty poor fit for go, you're better served by languages like python that can autogenerate classes that reflect the db schema. go's sweet spot is things like network servers.
- luckydata 6mo agoyou just need the right tools https://github.com/CaliLuke/loom https://github.com/CaliLuke/loom
- mywittyname 6mo agoGo tooling has this kind of thing as well. I'm not a huge fan of go, but last time I had to work with it, we leveraged a lot of codegen.
- stuaxo 6mo agoThis is straightforward in the first instance, but how do you see maintenance of those projects going forward - especially adding more complex features ? I can see one way forward being to prototype them in python and convert.
- nostrebored 6mo agoIt’s completely the opposite. LLMs write awful python. Horrendous. They write pretty reasonable go and do it quite quickly. We started in Python because of “the ecosystem”. It was a mistake. The amount of time we spend ripping out each dependency and pruning it to what we need is way higher than if we’d spent the month building out what we need. I miss compilers and LLMs will NOT generate config driven code or things that serde well. Everything has layers and layers of adapters by default and the domain model slowly erodes over time.
- rbanffy 6mo ago> It’s completely the opposite. LLMs write awful python. Horrendous. I've been using Claude Opus and it's pretty competent. I rarely have to make steering corrections. Once I had to deal with confusion, but, overall, the code is neat and the approaches sensible. It all depends on how much context you give it to work from, for instance. If it's building on top of a well organized codebase with a good best-practices document, it performs just fine.
- deppep 6mo agoi don’t really see it this way. the value of a token in Python is much higher than it is in lower-level language
- BOOSTERHIDROGEN 6mo agoInterested in why you'd use Python in the first place? Advice for someone who knows nothing about programming - what would you suggest?
- NegativeLatency 6mo agoTry a few, pick what you like
- IshKebab 6mo agoIMO 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 trying stuff out and want to plot graphs and so on. IMO it is undeservedly popular, or at least was. Wind back 10 years to when it was rapidly gaining mindshare: 1. While "hello world" is simple, if you went further to more complex programs you would hit two roadblocks: a) the lack of static type checking means large programs are difficult to maintain, and b) it's really really slow. 2. While the language is reasonable, the tooling (how you install packages, manage the code and so on) was eye-bleedingly abysmal. 3. While the REPL did technically exist, it was really bare bones. It couldn't even handle things like pasting code into it if the code contained blank lines (which it usually does). However since it has become arguably the most popular language in the world, a lot of people have been forced to use it and so it is actually getting quite decent now. It has decent static types (even if lots of people still don't use them), the REPL is actually decent now (this changed very recently), and there's a new third party tool called `uv` to manage your code that is actually good. The biggest issue with it now is that it's still horrifically slow (around 50-200x slower than "fast" languages like C++, Rust etc). It is pretty unlikely that that will ever change. People always try to excuse this by saying Python is a "glue" language and you just use it to connect components written in faster languages, but a) that's pure "you're holding it wrong", and b) that only works in some cases where there are nicely separated "slow bits" that can be moved to another language. That's the case for AI for example, where it's all numerical, but for lots of things it isn't. Mercurial was a competitor to Git that was written in Python and lost partly because it was way too slow. They've started writing parts in Rust but it took them 10 years to even start doing that and by then it was far too late. > what would you suggest? It really depends on what you want to make. I would pick something to make first and then pick the language based on that. Something like: * AI: Python for sure. Make sure you use uv and Pyright. * Web-based games: Typescript * Web sites: Typescript, or maybe Go. * Desktop GUI: Tbh I'd still use C++ with QtWidgets. Getting a bit old-school now tbf. Also Rust is the best language of them all, but I dunno if I'd pick it as a beginner unless you really know you want to get into programming.
- zabzonk 6mo agoThree 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.
- dkersten 6mo ago> 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).
- zabzonk 6mo agoWell, 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?
- rcxdude 6mo agoIn this context I would assume deleting code to mean deleting it from the current version of the software, not removing from the VCS history entirely.
- dkersten 6mo agoDeleted 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?
- squirrellous 6mo ago
- sinpif 6mo agoI'm still on the lookout for a comprehensive Django-like web framework for go. That would be an instant hit for me.
- pennomi 6mo agoSame here. Django is my last holdout for Python. Everything new is go.
- sirsinsalot 6mo agoI've found JS/TS Web stacks equally lacking and ugly after Django. I'm totally spoiled by a decade in Django. Just let me build a CRUD app, on the server, that spits out HTML without an excessive swamp of unmaintained nonsense and a cultish abhorrence of simplicity.
- andersonpico 6mo agowhat do django do that's contrived in js or say aspnet or rails?
- sirsinsalot 6mo agoWork
- seabrookmx 6mo agoTry another language? The Go ecosystem tends towards libraries as opposed to "frameworks." I personally chose C# for this reason, because ASP.NET is mature and (IMO) well designed. But there's also Java/Spring and and lots of other options in different languages depending on your preferences.
- sirsinsalot 6mo agoWell it might prefer libraries but the culture around basic DX things like ORMs is toxic. Just write the SQL yourself they say, until they themselves optimise to a half baked in-house ORM of their own.
- kokada 6mo agoFrom 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?
- boxed 6mo agoYes, 3.15+
- rad120 6mo ago[flagged]
- stingraycharles 6mo ago> 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.
- sigmoid10 6mo agoI 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.
- saghm 6mo agoThis 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.
- JohnKemeny 6mo ago> I've left this one to the bonus section because I've never used set operations on Counters and I'm finding it extremely hard to think of a use case for xor specifically. But I do appreciate the devs adding it for completeness. Check out symmetric difference https://en.wikipedia.org/wiki/Symmetric_difference https://en.wikipedia.org/wiki/Symmetric_difference
- qsort 6mo agoYeah, but applied to counters it would be the symmetric difference between multisets, which doesn't have a natural definition. If I understood the proposal they'd be defining it as absolute value of the difference of the counts, which isn't even associative. If they only considered parities it could be interpreted as addition in F_2, which is more natural, but I'd still agree that it's hard to see how you'd use something like this in practice.
- gtheodor 6mo agoYou can get the L_k distances between the two counters. E.g. if you sum the absolute value of the difference of the counts, you get the L_1 distance between the counters. If you raise them to the n^th power and then sum them, you get the L_n distance. For n=2, that's the Euclidean distance (squared).
- deleted 6mo ago[deleted]
- sunshine-o 6mo agoI am not a python dev but have the utmost respect for the ecosystem. But damn, with all the supply chain attacks now in the news, could they just make a simple way (for non python insiders) to install python apps without fearing to be infected by a vermin with full access to my $HOME ...
- surajrmal 6mo agoThere is little that they can do short of running the programs in a VM. Linux distros aren't engineered to consider applications as something different from the user running them. You need a completely different security model to achieve that and the Python runtime isn't tackle that.
- sunshine-o 6mo agoIn its inception 35 years ago the creator of python could not foresee how far python would go and how the environment would look like today. But nowadays there are a lot of security mechanisms they could leverage to adapt (from chroot by default to namespaces, cgroup, etc. on Linux, pledge, unveil on OpenBSD). The very idea that you offer a (python) package installer that is gonna pull a tree of code published and updated by random people in an unvetted manner open the door to all the supply chain attacks we are seeing. Around the same time (early 90s) Java was designed with high isolation in mind but the goal and vision was very different. And Java had its own problems. I'm saying that because at some point the security problem is gonna really hurt the python ecosystem.
- zahlman 6mo agoThe point is that nothing you are saying here has anything to do with Python or its design and would be equally true of any programming language with a comparable ecosystem.
- nyrikki 6mo agoThere is no security barrier at all in UNIX(-like) Os's between a caller/callee, this is not thing that python can just fix. There are ways to harden and/or reduce privileges, but shells/scripting languages will always have this issue on any modern OS. The UNIX way to help prevent that is really to run processes as another user, but people seem to refuse to do so. You should always expect any process running as your UID to be able to access any data owned or visible to your UID. While it is possible to reduce the risk of disclosure, they are all wack-a-mole preventions protecting the low hanging fruit, not absolute guarantees. That is purely due to how UNIX works [0] [0] https://man7.org/linux/man-pages/man7/credentials.7.html https://man7.org/linux/man-pages/man7/credentials.7.html
- armanj 6mo agofunny how we may have to wait even longer for llms to pick up this update in their pre-training
- Alifatisk 6mo agoIs there seriously no solution to this? Perhaps something we fan do post training? For example add the new features to SKILLS.md? But the trade-off here is of course tokens.
- shankysingh 6mo agoMy working methodology has been , LLM output is a jumping point and to use my experience, knowledge and basic understanding to N+1 it. So for bleeding edge stuff it works out well or in places where documentation is not great like Apache Flink.
- BiteCode_dev 6mo agoIt's actually fantastic for job interviews. Use that trick with my clients when asked to review candidates.
- kwon-young 6mo agoIt's nice that python 3.15 added Iterator synchronization primitives: https://docs.python.org/3.15/library/threading.html#iterator-synchronization https://docs.python.org/3.15/library/threading.html#iterator.... These will nicely complement my threaded-generator package which is doing just this but using a thread/process+generator+queue: https://pypi.org/project/threaded-generator/ https://pypi.org/project/threaded-generator/
- veqq 6mo agoThere's a good interview about Python internals and management, particularly in relation to free-threading: https://alexalejandre.com/programming/interview-with-ngoldbaum/ https://alexalejandre.com/programming/interview-with-ngoldba...
- syedMohib45 6mo agoThread safe ittertors? really are we still on these topics 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)
- drchaim 6mo agoOh, my beloved Python, for nearly 15 years I wrote you. I miss you, but I no longer do — it's not your fault, life has changed.
- speedster217 6mo agoI've really been enjoying modern Python both at work and on personal projects.
- amelius 6mo agoIs anyone working on a more capable Python-like language which also interfaces well with Python but without the baggage?
- jwineinger 6mo agoOne of the Counter examples is incorrect, tested on both 3.13 and 3.15.0a >>> from collections import Counter >>> c = Counter(a=3, b=1) >>> d = Counter(a=1, b=2) >>> c-d Counter({'a': 2})
- zuminator 6mo agoI noticed that as well. Per the docs: Several mathematical operations are provided for combining Counter objects to produce multisets (counters that have counts greater than zero). Addition and subtraction combine counters by adding or subtracting the counts of corresponding elements. Intersection and union return the minimum and maximum of corresponding counts. Equality and inclusion compare corresponding counts. Each operation can accept inputs with signed counts, but the output will exclude results with counts of zero or less. Anyway, nice Counter-example ;-)
- xg15 6mo ago> Iterators, async functions and async iterators don't work well here because they have different semantics to standard functions. When you call them they return immediately with a generator object, coroutine function and async generator object respectively. So the decorator completes immediately as opposed to the entire lifecycle what it's wrapping. > This is an unfortunate problem I've encountered many times, and it's often a problem for normal decorators too. But this has changed in 3.15, now the ContextDecorator will check the type of the function it's wrapping and ensure that the decorator covers the entire lifespan. I very much like the idea of that change - but it also seems kind of dangerous, to do this with no "opt-in mechanism", as that quite subtly changes the behavior of existing usage sites. This is a bit of a "spacebar heating" situation, because someone would have to intentionally use a decorator in the old, broken way, but if someone actually did that, things may unexpectedly break.
- ameliaquining 6mo agoThe Python core team seems to think it's unlikely that anyone's relying on the existing behavior: https://github.com/python/cpython/pull/136212#issuecomment-4332309019 https://github.com/python/cpython/pull/136212#issuecomment-4...
- xg15 6mo agoOk, good to see that they checked that possibility. Looks like there was no situation in which the previous behavior could have been usable, so yeah, agreeing with the change then.
- Drakim 6mo agoEh, what's the worst that could happen? Developers opting to run an old version of Python due to incompatible changes? I can't see that happening.
- deleted 6mo ago[deleted]
- aniou 6mo agoI come to Python around version 1.5, painfully tired by debugging CGI scripts, created by wannabe perl-golfers. Unfortunately, I feel like Python is losing more and more of the zen that once tempted me... Lazy loading looks like a last nail in the coffin, where my love to Python was buried, although it was a long, tiresome process.
- t43562 6mo agoIt's now being used by a lot of people because they have to rather than want to so there is a desire to ** it up and reinvent their favorite language by adding all sorts of warts. That's the price of success. A proper revenge would be to introduce "easy mode" to Rust - where the compiler takes a huge chill pill and you get non-enforced garbage collection. :-)
- BiteCode_dev 6mo agoNote that 3.15 is not released yet. It will come out in 4 months
- vorsken 6mo agoThe `except*` improvements are underrated. Been using ExceptionGroup in a CLI tool that wraps Semgrep — catching multiple subprocess errors cleanly in one block made the retry logic much simpler.
- axpy906 6mo agoWhen Wes McKinney wrote about the transition away from python I knew it was real. https://wesmckinney.com/blog/agent-ergonomics/ https://wesmckinney.com/blog/agent-ergonomics/ I still have a special place in my heart for the language and think it’s still got a niche.
- groundzeros2015 6mo agoWhy does every language need every feature? Python has completely lost its charm.
- t43562 6mo agoIt's too popular and the people channeled into using it don't care about it other than to complain about why it isn't <insertlanguagehere>
- frr149 6mo agoI used to be obsessed about language design and now, since I almost never write code directly (it's always Claude), I completely lost interest. It feels like a total waste of time and I wonder if other feel the same. One of the consequences of the LLM tsunami might be the freezing of research and development in programming languages. Maybe we'll be stuck with J's and python forever...
- inejge 6mo ago> I almost never write code directly (it's always Claude) Who, then, understands the code? If the answer is "no one really", entropy will overwhelm your codebase sooner or later. Otherwise, you need to read the code, and for that the knowledge of language is still relevant.
- NotOscarWilde 6mo ago> If the answer is "no one really", entropy will overwhelm your codebase sooner or later. Otherwise, you need to read the code I think about this on the regular -- I know the answer is currently "you own the code, so you have to understand it", but to unlock the true productivity multiplier, in the future, the answer has to be "no one really". I think about it using the concepts from my job (academia) -- to actually have PhD student-level intelligence means that you have to trust that it does a good enough job that you can focus on other stuff. Professors often bring the correct ideas or intuitions, but they have to trust the PhD student to write the code and/or fill in the gaps in the proofs -- they can advise them on the high-level issues during a consultation, but that's about it. I am pretty bad at working in the current LLM workflow -- it is tough for me to focus on reading a TCS paper for review, keeping all the details and invariants in my head, but every 5-10 minutes go to my PC, completely switch contexts/projects, read the code and think about the LLM's comments, suggest the next step, and then go back to reading.
- t43562 6mo agowell, no need to peer-review papers anymore then! If we're to unlock the true productivity that is...
- dhruv3006 6mo ago> Immutable JSON Objects With the addition of frozendict in 3.15, we now have the ability to represent all the json types (array, boolean, float, null, string, object) in immutable (hashable) forms. I actually love this last feature !!
- danborn26 6mo agoThese smaller features often end up being the most useful. I'm especially interested in testing the new standard library additions in my current projects.
- JamesConnor_Dev 6mo ago[flagged]
- GeorgeTirebiter 6mo agoAbsolutely serious question: is anybody actually writing code anymore? (Reviewing it, architecting it, sure -- we do that). But writing code? If NOT, then seems to me, what we want in our LLM output is CODE THAT IS TRIVIAL TO UNDERSTAND (I apologize for shouting from the rooftops.) I'm not sure adding 'features' to Python anymore makes sense - UNLESS those features help humans understand LLM code. Part of the problem is, of course, that LLMs haven't been trained on the latest-and-greatest, so they won't output any of it (even new training events won't capture the latest very much, since there is so little of it relative to what is already out there). But again -- do new features help HUMANS understand what the LLMs produce? If not, seems to me ... new features merely add complexity for no apparent gain. (Or am I confused about this?) THANKS for any helpful opinions.
- GeorgeTirebiter 6mo agoWow, the Python folks do not want to entertain different goals for the language, it would seem. I still remain interested in whether it makes sense to add features to Python anymore, given that LLMs write all the code. Unless, as I said, such features enhance human comprehension (since we have to review the code the LLM produces).
- t43562 6mo agoIf you don't write code you won't understand what you're reviewing. Any manager discovers this - their ability to review atrophies.