My Favorite New Python 3.15 Language Features
Python 3.15 is scheduled for release on October 1st, 2026.1 With its release approaching, I performed the usual routine of looking at what new features the new version has to offer. So why not share my favorites here?
You can check all the new features here.
1. Explicit lazy imports (PEP 810)
You can now write lazy import foo or lazy from foo import Bar and the module will be loaded only when used. This is to avoid the practice of importing a library in the body of a function or class. I used this pattern a lot at work in order to avoid loading libraries with big loading times when not needed. However, I never liked to obscure dependencies inside some deep function. I like my imports to be clear and visible up front. Finally, now I don’t need to worry about this anymore.
2. A builtin sentinel() type (PEP 661)
You can now use sentinel() to create a sentinel, replacing the MISSING = object() idiom.
I have not used this pattern a lot, but it happened. If you don’t know it, it is a way to differentiate between a missing value and an explicit None.
Imagine that you are creating a function that updates a user like the following:
| |
Once you reach the inside of that if block, you have a problem. Is name None because the user didn’t provide a value, or because the user explicitly passed None?
In practice, update_user() and update_user(name=None) are virtually indistinguishable. The solution, so far, was to use a “hack” like the following:
| |
But using a plain object() comes with some annoyances. Now, you can use sentinel() and, I suppose, everything will be more clear.
3. Unpacking inside comprehension (PEP 798)
This is a small but handy language feature. It will now be possible to write [*xs for xs in things] instead of [x for xs in things for x in xs] to “flatten” a list of lists. The same is true for dict types as well.
I know it is not much, but I always mix up the order of for xs in things for x in xs, so I guess this will save me some mental overhead.
4. frozendict is now a built-in type (PEP 814)
As the title says, finally frozendict is a built-in type!
Python for Practical Statistics

These days were a bit busy. I want to break the silence with an interesting link to a video. This is an interesting and fun to watch talk coming from the last PyCon. It talks about “practical statistics”, that is, how you can try to produce (or validate) a model when you can not compute the analytic model of a phenomenon. Many of the technique he describes can be used to any language, so it is suitable even if you do not program in Python. Anyway, look that, it is worth it. Moreover, this is just an excuse to suggest you to look around all the other videos from PyCon. They are well made and there are some interesting talk that should be watched.
How to use Rust in Python (Part 3)

You can follow the links to read the first part and the second part of this series.
In the previous part we have seen how to pass not trivial data to Rust functions such as a Python list. It is still not enough, though. In many cases we need to pass complex data structure back and forth from a Rust library. We may need to pass quaternions, 3D points, trees, a list of “books”… In short: anything.
Learning how to pass custom aggregated data types to Rust libraries (and back to Python) will be the focus of this part!
How to use Rust in Python (Part 2)

You can find the first part of this article HERE.
In the previous part we have seen how to run simple Rust functions with integer arguments. This is not enough, of course. We need to go further by passing Python lists to Rust functions.
The problem is that it is not possible to pass directly a Python list to a C interface. Python lists (we can call them Plists) are complicated beasts, you can easily see that they are objects full of methods, and attributes and… Stuff.
| |
We need first to convert this in something edible from a Rust library. But first things first.
How to use Rust in Python (Part 1)

Rust is an amazing language. It is one of the best potential alternatives to C and has been elected two times in a row as the most promising language of the year (by me, :P). However, because its strict compile-time memory correctness enforcement and because it is a low-level language, it is not the fastest way to build a prototype. But don’t worry! Rust is the perfect language for embedding fast-binary libraries in Python! In this way we can get the best of both worlds!
Writing Rust code that can be executed in Python is stupidly easy. Obviously, you have to well design the interface between the two languages, but this will improve your Python code in two ways: 1) You can execute CPU-intensive algorithms at binary speed and 2) use real threads instead of the Python “simulated” ones (and because Rust is designed to be memory safe, writing thread safe routines is much easier). Let’s see!
Convert images to MovingAI maps

The MovingAI Benchmark Database is one of the most famous collections of maps for benchmark on pathfinding algorithms. I use it a lot during my work, it is useful to test an algorithm over a lot of real-world game maps. The consequence is that I developed a lot of tools to work with the map format of the MovingAI database.
The last of these tools is a straightforward Python script to convert images into maps in the MovingAI format. It is useful when you want to quickly develop some test maps.
YoshiX: Experiments made easy

Some months ago, I was frustrated by the monotony of the task of writing, running and collecting data from experiments. I was bored of facing always the same challenges, writing always the same code and facing always the same problems. In addition, every experiment ran on different platforms, and they quickly become difficult to replicate (and this should be the very point of every experiment).
Thus, I decided to write my personal framework for running experiments in Python: YoshiX. The idea behind YoshiX, inspired by classical Unit Testing libraries, is quite simple. You write your test in a separate file, then you run yoshix and it automatically finds every experiment in a specific folder, runs them, and collects the output in the format of choice.
It is a simple tool; I still have not spent a lot of time in it. But I think it has some interesting developments. Let’s look into some details.