Rodrigo Girão Serrão 🐍🚀
@mathspp.com
I'll help you take your Python skills to the next level!
Get a daily drop of Python knowledge 🐍💧 -> https://mathspp.com/drops
Pydon'ts – free Python book 👉 https://mathspp.com/books/pydonts
Get a daily drop of Python knowledge 🐍💧 -> https://mathspp.com/drops
Pydon'ts – free Python book 👉 https://mathspp.com/books/pydonts
I was thinking about those 6, yeah: upper, lower, title, capitalize, casefold, swapcase
November 10, 2025 at 5:44 PM
I was thinking about those 6, yeah: upper, lower, title, capitalize, casefold, swapcase
Oh no! That's the type of bug I would take ages to find...
November 10, 2025 at 5:44 PM
Oh no! That's the type of bug I would take ages to find...
For example, ALL functions are Truthy, regardless of what they do.
Even a function that does nothing is Truthy.
```py
def foo():
pass
print(bool(foo)) # True
```
(By the way, you can check the Truthy/Falsy value of something with the built-in `bool`.)
Even a function that does nothing is Truthy.
```py
def foo():
pass
print(bool(foo)) # True
```
(By the way, you can check the Truthy/Falsy value of something with the built-in `bool`.)
November 10, 2025 at 10:54 AM
For example, ALL functions are Truthy, regardless of what they do.
Even a function that does nothing is Truthy.
```py
def foo():
pass
print(bool(foo)) # True
```
(By the way, you can check the Truthy/Falsy value of something with the built-in `bool`.)
Even a function that does nothing is Truthy.
```py
def foo():
pass
print(bool(foo)) # True
```
(By the way, you can check the Truthy/Falsy value of something with the built-in `bool`.)
Then, all other values are “Truthy”.
E.g., the empty list is Falsy but any other list is Truthy.
So, you can use the Truthy/Falsy value of a list to check if it's empty.
This is very idiomatic in Python.
Some other types don't have Falsy values!
E.g., the empty list is Falsy but any other list is Truthy.
So, you can use the Truthy/Falsy value of a list to check if it's empty.
This is very idiomatic in Python.
Some other types don't have Falsy values!
November 10, 2025 at 10:54 AM
Then, all other values are “Truthy”.
E.g., the empty list is Falsy but any other list is Truthy.
So, you can use the Truthy/Falsy value of a list to check if it's empty.
This is very idiomatic in Python.
Some other types don't have Falsy values!
E.g., the empty list is Falsy but any other list is Truthy.
So, you can use the Truthy/Falsy value of a list to check if it's empty.
This is very idiomatic in Python.
Some other types don't have Falsy values!
I’ll write more about it tomorrow in my insider newsletter.
(Link in the bio.)
I’ll also share some examples so you can see what I’m talking about.
(Link in the bio.)
I’ll also share some examples so you can see what I’m talking about.
November 9, 2025 at 5:48 PM
I’ll write more about it tomorrow in my insider newsletter.
(Link in the bio.)
I’ll also share some examples so you can see what I’m talking about.
(Link in the bio.)
I’ll also share some examples so you can see what I’m talking about.
You'll learn to
👉 one-shot data (de)compression;
👉 write and read from compressed files; and
👉 compress and decompress data incrementally.
These are the most common and simpler scenarios.
If you want to give it a read, you can check it here: mathspp.com/blog/module...
👉 one-shot data (de)compression;
👉 write and read from compressed files; and
👉 compress and decompress data incrementally.
These are the most common and simpler scenarios.
If you want to give it a read, you can check it here: mathspp.com/blog/module...
Module compression overview
A high-level overview of how to use the module compression, new in Python 3.14.
mathspp.com
November 8, 2025 at 12:02 AM
You'll learn to
👉 one-shot data (de)compression;
👉 write and read from compressed files; and
👉 compress and decompress data incrementally.
These are the most common and simpler scenarios.
If you want to give it a read, you can check it here: mathspp.com/blog/module...
👉 one-shot data (de)compression;
👉 write and read from compressed files; and
👉 compress and decompress data incrementally.
These are the most common and simpler scenarios.
If you want to give it a read, you can check it here: mathspp.com/blog/module...
The five modules have some pretty similar APIs...
Which was expected, since their purposes are essentially the same.
So, I wrote a short article that provides an overview of how to compress/decompress data using `compression`.
Which was expected, since their purposes are essentially the same.
So, I wrote a short article that provides an overview of how to compress/decompress data using `compression`.
November 8, 2025 at 12:02 AM
The five modules have some pretty similar APIs...
Which was expected, since their purposes are essentially the same.
So, I wrote a short article that provides an overview of how to compress/decompress data using `compression`.
Which was expected, since their purposes are essentially the same.
So, I wrote a short article that provides an overview of how to compress/decompress data using `compression`.
But `zstd` is a brand new compression module added in Python 3.14.
All of these modules can be accessed from `compression`:
```py
from compression import bz2, gzip, lzma, zlib, zstd
```
The older 4 can still be imported directly:
```py
import bz2, gzip, lzma, zlib
```
All of these modules can be accessed from `compression`:
```py
from compression import bz2, gzip, lzma, zlib, zstd
```
The older 4 can still be imported directly:
```py
import bz2, gzip, lzma, zlib
```
November 8, 2025 at 12:02 AM
But `zstd` is a brand new compression module added in Python 3.14.
All of these modules can be accessed from `compression`:
```py
from compression import bz2, gzip, lzma, zlib, zstd
```
The older 4 can still be imported directly:
```py
import bz2, gzip, lzma, zlib
```
All of these modules can be accessed from `compression`:
```py
from compression import bz2, gzip, lzma, zlib, zstd
```
The older 4 can still be imported directly:
```py
import bz2, gzip, lzma, zlib
```
You still have some time to come up with that third idea.
November 7, 2025 at 2:26 PM
You still have some time to come up with that third idea.
They allow you to avoid using multiple `if` statements to append portions of the result to a final result string.
By using these fragments (and by using empty strings when the fragments are unnecessary), you keep your code flatter and cleaner.
By using these fragments (and by using empty strings when the fragments are unnecessary), you keep your code flatter and cleaner.
November 7, 2025 at 2:25 PM
They allow you to avoid using multiple `if` statements to append portions of the result to a final result string.
By using these fragments (and by using empty strings when the fragments are unnecessary), you keep your code flatter and cleaner.
By using these fragments (and by using empty strings when the fragments are unnecessary), you keep your code flatter and cleaner.
I still have to submit my proposals! good job doing that early. I’ll likely end up doing it last minute, as per usual 😒
November 6, 2025 at 11:25 PM
I still have to submit my proposals! good job doing that early. I’ll likely end up doing it last minute, as per usual 😒
A similar thing happened to me the other day. Thankfully, it was just a 2 minute video, not a 30 minute one D:
November 6, 2025 at 2:41 PM
A similar thing happened to me the other day. Thankfully, it was just a 2 minute video, not a 30 minute one D:
It's essentially a directory of standalone HTML files, yes.
My repo: github.com/mathspp/tools
It's a dumbed down/simplified version of github.com/simonw/tools
The tools live online at tools.mathspp.com
My repo: github.com/mathspp/tools
It's a dumbed down/simplified version of github.com/simonw/tools
The tools live online at tools.mathspp.com
November 5, 2025 at 10:03 PM
It's essentially a directory of standalone HTML files, yes.
My repo: github.com/mathspp/tools
It's a dumbed down/simplified version of github.com/simonw/tools
The tools live online at tools.mathspp.com
My repo: github.com/mathspp/tools
It's a dumbed down/simplified version of github.com/simonw/tools
The tools live online at tools.mathspp.com
I didn't do a direct donation but instead waived the fee I was awarded when I got my community service award ($599). Will you folks match that? ❤️ What kind of proof would you folks need?
November 4, 2025 at 6:24 PM
I didn't do a direct donation but instead waived the fee I was awarded when I got my community service award ($599). Will you folks match that? ❤️ What kind of proof would you folks need?