5 ms·
What's New in Python 3.15
- PaulHoule 10mo agoPEP 686 makes me smile https://peps.python.org/pep-0686/ https://peps.python.org/pep-0686/
- lucb1e 10mo ago"PEP 686 – Make UTF-8 mode default" for anyone else wondering
- edflsafoiewq 10mo agoCan definitely think of some places I should use bytearray.take_bytes.
- pjmlp 10mo agoI am here for the JIT and improved profiling goodies, one day Python will finally be a proper Lisp replacement. -- https://www.norvig.com/python-lisp.html https://www.norvig.com/python-lisp.html
- nurettin 10mo agoI had a colleague who was hostile to any language other than common lisp. Except python, which I assume is just because this page exists. What if norvig woke up that day and decided to write about Ruby instead?
- pjmlp 10mo agoWhich incidentely has a much better history with JIT adoption than Python, where the community has largely ignored PyPy. Meanwhile Ruby has had MacRuby from Apple, later canceled, but the main developers went out creating RubyMotion. Sun toyed with JRuby, it was even officially supported on Netbeans, then Red-Hat supported the project for a while. It was also one of the first dynamic languages on GraalVM, with TruffleRuby. GraalPy effort only came a couple of years later, and is still on baby steps. As of 2025, the refernce implementation counts with YJIT, MJIT, TenderJIT, and MRuby 4 brings ZJIT to the party. Exchanging Lisp for Python we went backwards in regards to performance in dynamic languages, in a distopian world where C, C++, Fortran libraries are "Python" libraries. Nope they are bindings, and any language with FFI can have bindings to those same libraries, e.g. PyTorch can also be used in straight C++, or from Java.
- mistrial9 10mo agoPython community -- meet Schrödinger's cat
- nurettin 10mo agoSpecial mention and thanks to headius (Charles Oliver Nutter) for his contributions to JRuby, he enabled many of my cross-platform projects back in 201* which would have been harder to build without the expressive and terse syntax Ruby provides and the ability to run jvm pretty much anywhere.
- BoingBoomTschak 10mo agoWithout s-exprs nor macros? Without reader? With its stupid statement/expression divide? ...Right.
- pjmlp 10mo agoThere is a good compromise with reflection, attributes, metaclasses, one line lambdas, comprehensions Now the lack of machine code generation for something Lisp was doing in the 1960's, Smalltalk in the 1980's, SELF in 1990's, and having to fall back on C, C++ and Fortran is bonkers. Thankfully this is finally becoming a priority for those willing to sponsor the effort, and kudos to those making it happen. I would rather use Common Lisp, in something like Allegro, but I will hardly find such a job, thus only arguing about language features doesn't take us that far.
- vrighter 10mo agoa lambda that forces you to define a function elsewhere if you want to do anything nontrivial in it defeats the purpose
- cassepipe 10mo agoWhat's Python's story for repl driven development ?
- pjmlp 10mo agoIt has a Tk based REPL and debugger in the box, and I guess nowadays Jupiter notebooks is the closest to a Lisp Machines/Interlisp-D kind of development. There are the IDE integrations as well. Pity is the lack of (compile ...) and (decompile ....), or similar. Which by the way is available in Julia.
- sceadu 10mo agoI usually do REPL driven development in Python via emacs but you can tell it's not the natural way to do things, esp. if you start doing stuff with async. But I still feel that it makes me way more productive than I would otherwise be
- hulitu 10mo ago> one day Python will finally be a proper Lisp replacement. Parantheses in Lisp are visible, whitespaces in Python, not really.
- ErenayDev 10mo agoSeeing this reminded me of version 3.14, where π is an infinity expressed through its fractional parts.
- ruuda 10mo ago> Python now uses UTF-8 as the default encoding, independent of the system’s environment. Nice, not specifying the encoding is one of the most common issues I need to point out in code reviews.
- joshribakoff 10mo agoHave you considered reducing review noise by using static analysis?
- formerly_proven 10mo agoencode()/decode() have used UTF-8 as the default since Python 3.2 (soon, 15 years ago). This is about the default encoding for e.g. the "encoding" parameter of open().
- franga2000 10mo agoYou mean the coding= comment? Where are you shipping your code that that was actually a problem? I've never been on a project where we did that, let alone needed it.
- 10mo ago
- stabbles 10mo ago> On POSIX platforms, platlib directories will be created if needed when creating virtual environments, instead of using lib64 -> lib symlink. This means purelib and platlib of virtual environments no longer share the same lib directory on platforms where sys.platlibdir is not equal to lib. Sigh. Why can't they just be the same in virtual environments. Who cares about lib64 in a venv? Just another useless search path.
- wdroz 10mo agoIn the improved error message [0] how are they able to tell nested attributes without having a big impact in performance? Or maybe this has a big impact on performance, then using exceptions for control flow is deprecated? ... print(container.area) > AttributeError: 'Container' object has no attribute 'area'. Did you mean: 'inner.area'? [0] -- https://docs.python.org/3.15/whatsnew/3.15.html#improved-error-messages https://docs.python.org/3.15/whatsnew/3.15.html#improved-err...
- edflsafoiewq 10mo agoHere's the relevant diff: https://github.com/python/cpython/pull/137968/files#diff-96634ca56022c201d0ff677e922810a97e4ad8a55de53258cf0cbc22bd7c9be1R1604 https://github.com/python/cpython/pull/137968/files#diff-966... Search is limited to 20 attributes and non-descriptors only to avoid arbitrary code execution. I assume constructing AttributeErrors isn't highly performance sensitive.
- IshKebab 10mo agoUsing exceptions for flow control has always been a bad idea, despite what they might have said. Perhaps they are generating that message lazily though? On the other hand it's not like Python really cares about performance....
- amluto 10mo agoI would like to introduce you to StopIteration.
- formerly_proven 10mo agoAll iterators in Python use exceptions for flow control, as do all context managers for the abort/rollback case, and it is generally considered Pythonic to use single-indexing (EAFP) instead of check-then-get (LBYL) - generally with indexing and KeyError though and less commonly with attribute access and AttributeError. [heavy green check mark] try: data = collection['key'] except KeyError: data = ..try something else.. [red x] if 'key' in collection: data = collection['key'] else: data = ..try something else.. The latter form also has the genuine disadvantage that nothing ensures the two keys are the same. I've seen typos there somewhat often in code reviews.
- vb-8448 10mo agowhat about making python 5x faster(faster-cpython project)?
- pansa2 10mo ago> faster-cpython project Seems to have died the same death as Unladen Swallow, Pyston, etc: https://discuss.python.org/t/community-stewardship-of-faster-cpython/92153 https://discuss.python.org/t/community-stewardship-of-faster...
- kenjin4096 10mo agoI'm the author of the thread you linked. Community stewardship is actually happening in some form or another now. 3.15 has some JIT upgrades that are in-progress. This has a non-exhaustive list of them https://docs.python.org/dev/whatsnew/3.15.html#upgraded-jit-compiler https://docs.python.org/dev/whatsnew/3.15.html#upgraded-jit-...
- Qem 10mo agoThere's some nice improvements expected by 3.16. See https://fidget-spinner.github.io/posts/faster-jit-plan.html https://fidget-spinner.github.io/posts/faster-jit-plan.html
- testdelacc1 10mo agoWorth mentioning that this is the documentation of 3.15 alpha 3. I feel like we’re better waiting for a release candidate or the final version before posting this page, in case there are any changes. Most people reading this are going to assume it’s final.
- amelius 10mo agoCool, now I just have to wait until my dependencies support this version.
- lucb1e 10mo agoDoesn't look to me like much got removed that was commonly used. What dependencies do you use that wouldn't automatically work on this version?
- regularfry 10mo agoIt's not that uncommon for libraries to declare an overly strict maximum version, even if the code would actually work, because they can't know that at time of setting the version constraint.
- lucb1e 10mo agoWho'd want to be sure it fully breaks with an update instead of having a small chance (a part of) it breaks with an update?!
- regularfry 10mo agoThe people who are currently doing so, presumably.
- nemetroid 10mo agoThe new profiling.sampling module looks very neat, but I don't see any way to enable/disable the profiler from code. This greatly limits the usefulness, as I am often in control of the code itself but not how it is launched.