Pinned Tweet
Python 3.15.0 was just released!
To celebrate, I'm doing 15 days of Python 3.15.
Each week day, I'll write about a new Python 3.15 feature.
We'll cover lazy imports, the new built-ins, the DX improvements, some new stdlib niceties, and MUCH more.
I'll collect my posts here ๐
To celebrate, I'm doing 15 days of Python 3.15.
Each week day, I'll write about a new Python 3.15 feature.
We'll cover lazy imports, the new built-ins, the DX improvements, some new stdlib niceties, and MUCH more.
I'll collect my posts here ๐
1
4
17
1,493
I can't remember Python before this.
Before Python underlined the part of the line that raised the error.
Who remembers what Python version this was added on?
Before Python underlined the part of the line that raised the error.
Who remembers what Python version this was added on?
1
0
1
1,129
What do you do when you can't use `None` as the default?
You can use `object()`...
Or a singleton class...
Or another workaround...
And all these hacks had flaws.
That's why Python 3.15 introduced the built-in `sentinel`.
You can use it to create placeholder values ๐
You can use `object()`...
Or a singleton class...
Or another workaround...
And all these hacks had flaws.
That's why Python 3.15 introduced the built-in `sentinel`.
You can use it to create placeholder values ๐
1
0
6
1,074
There are many benefits to using `sentinel`.
One of them is that typing sentinels is much cleaner than typing any of the alternatives.
That's because sentinels can be used as their own type.
Just like `None` can ๐
One of them is that typing sentinels is much cleaner than typing any of the alternatives.
That's because sentinels can be used as their own type.
Just like `None` can ๐
1
1
1
231
If you want to learn more about how to create and use placeholder values in 3.15, read the article below
mathspp.com/blog/pydonts/sโฆ
mathspp.com/blog/pydonts/sโฆ
0
0
1
186
Python startup times just got faster.
In 3.15, you can use the keyword `lazy` to make a lazy import (`math` and `Path` below).
Lazily imported modules are only loaded
WHEN they're used, and
IF they're used.
Use them to defer loading of modules that may not be required.
In 3.15, you can use the keyword `lazy` to make a lazy import (`math` and `Path` below).
Lazily imported modules are only loaded
WHEN they're used, and
IF they're used.
Use them to defer loading of modules that may not be required.
1
0
8
1,296
If you want to learn more about explicit lazy imports.
See use case scenarios.
Learn how to make them backwards compatible.
Etc.
Read this blog post:
mathspp.com/blog/explicit-โฆ
See use case scenarios.
Learn how to make them backwards compatible.
Etc.
Read this blog post:
mathspp.com/blog/explicit-โฆ
1
0
0
224
I'm doing 15 days of Python 3.15.
Follow @mathsppblog for the whole journey.
Check my profile for the free email series.
Follow @mathsppblog for the whole journey.
Check my profile for the free email series.
0
0
0
184
What's the consensus on `sentinel` vs `None`?
Assume no backwards compatibility concerns.
Do you still use `None` for pretty much all โnothingโ usages and use `sentinel` only when `None` doesn't cut it?
Or are you going to default to `sentinel` for placeholders?
Assume no backwards compatibility concerns.
Do you still use `None` for pretty much all โnothingโ usages and use `sentinel` only when `None` doesn't cut it?
Or are you going to default to `sentinel` for placeholders?
2
0
1
1,316
Who had this ridiculous idea of doing 15 blog articles about Python 3.15 in 15 days while also running 5 workshops in 10 days?
My weekly Monday newsletter is delayed and will only be coming out tomorrow ๐ค
My weekly Monday newsletter is delayed and will only be coming out tomorrow ๐ค
2
0
7
1,404
Who else is compulsively running `uv self update` to get 3.15.0 through uv?
@dsmproengineer Yup coming today
3
0
13
2,428
๐ Top 5 Python 3.15 features to start using today:
1. Lazy imports
2. New built-in `frozendict`
3. New built-in `sentinel`
4. Unpacking inside comprehensions
5. New sampling profiler Tachyon
What's your top Python 3.15 new feature?
1. Lazy imports
2. New built-in `frozendict`
3. New built-in `sentinel`
4. Unpacking inside comprehensions
5. New sampling profiler Tachyon
What's your top Python 3.15 new feature?
4
2
9
1,973
To learn more about each of these features, you can see examples and explanations here:
mathspp.com/blog/the-5-mosโฆ
mathspp.com/blog/the-5-mosโฆ
0
0
2
334











