Sign in

Rodrigo Girão Serrão 🐍🚀

@mathspp.com
1.2K followers 313 following 1.3K posts

I'll help you take your Python skills to the next level! Python deep dive every Monday 🐍🚀 -> mathspp.com/insider Short daily drop of Python knowledge 🐍💧 -> mathspp.com/drops

PostsRepliesMedia
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 27/08/2026
Why does OOP exist? Why does it work the way it does? What's up with the magic in `self`? If you're new-ish to OOP I expect this article to fundamentally change the way you understand OOP. (For the better!) If it doesn't, I failed. You can read it here 👉 mathspp.com/blog/why-oop...
mathspp.com
Why OOP exists
Learn the fundamental principles behind OOP and how they connect to the syntax of Python.
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 13/08/2026
Thanks! I didn’t see the GC/GB cases (post?) so I guess I didn’t have enough context… But if it’s just the spines you slip in, do you know what I’m thinking? Does it look good when you see the case from the front/back or does it look weird with the visible edges of the spine?
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 12/08/2026
Looks much better with the cool cover spines! How did you do this? Do you print just the spine (doesn’t look like it) or do you reprint the full case cover? What’s your process? 👀
110
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 05/08/2026
Hey Chris, are you missing the usual link to “this week's episode”?
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 26/05/2026
I remember working with Pascal a little bit — at a basic level, for a class I had. I found the distinction between procedures and functions quite curious!
130
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 26/05/2026
Python functions summarised in sentence: “Functions either return something or they blow up” — A student of mine
150
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 25/04/2026
Hey! I am not making any immediate connection with an email address but I definitely recognise your nick/profile picture from X/Twitter.
020
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 25/04/2026
Yup, I got that email :)
020
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 25/04/2026
The blast radius is also the larger circle 😂
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 24/04/2026
Your frontier of competence is expanded by LLMs based on your current knowledge.
A diagram showing how LLMs are more useful if you know more a priori. Two circles of different sizes represent your current knowledge and the LLM extends either circle by the same amount, so if your initial circle is larger than your ending circle is also larger.
210
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 21/04/2026
My scientific hero is the reader. They're always the ones doing all the hard proofs.
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 20/04/2026
I'm trying to reach out to Charlie Marsh @crmarsh.com because of the upcoming EuroPython conference. Do I know anyone here who can help me get to him? Thanks 🙏
002
Reposted by Rodrigo Girão Serrão 🐍🚀
Fredrik Mellström @traal.se · 09/04/2026
These uv Python skills for coding agents look promising. From @mathspp.com mathspp.com/blog/uv-skills
mathspp.com
uv skills for coding agents
This article shares two skills you can add to your coding agents so they use uv workflows.
121
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 13/04/2026
Thanks for sharing ^^
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 08/04/2026
If you’re at PyCon Lithuania 🇱🇹 #PyConLT, join me to learn about the paradox of itertools.tee in the Diamond room at 11am. See you there!
022
Reposted by Rodrigo Girão Serrão 🐍🚀
Sam Rose @samwho.dev · 25/03/2026
I spent 2 months learning about quantization and am extremely proud of the post I've written about it. I think these are some of the nicest visuals I've ever made, and I love how this compression technique invented in 1898 is being used on the bleeding edge in 2026. ngrok.com/blog/quantiz...
ngrok.com
Quantization from the ground up | ngrok blog
A complete guide to what quantization is, how it works, and how it's used to compress large language models
1425155
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 25/03/2026
The post _was_ great, thanks for sharing. And the interactive visuals work really well. My favourite detail? The mechanical feel you get when you slide the slider for the integers and the corresponding base-2 bits flip.
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 25/03/2026
Congratulations for all of the hard work you've been doing!
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
I forgot a semicolon and my site was down for ~4 hours without me even knowing. The joys of programming. 😂
031
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
The REPL is a good one! 👍
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
This was ahead of Magritte's time :D
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
Thanks for educating me!
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
What is a “Magritte moment”?
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/03/2026
What's your favourite vanilla Python feature? (Abuses of the Python syntax are valid answers.)
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 21/03/2026
For me it played to quickly on mobile so sometimes I even struggled understanding whose turn it was :) I think that’s the main benefit of having something persistent. Perhaps move notation at the bottom? 🤷 I like the rationale for the site!
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 19/03/2026
Astral just entered into an agreement with OpenAI to integrate their Codex team! openai.com/index/openai...
openai.com
OpenAI to acquire Astral
Accelerates Codex growth to power the next generation of Python developer tools
001
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 17/03/2026
Thanks! I do my best 🙏
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 17/03/2026
Too many arrows?
Diagram using recursive structural pattern matching and unpacking inside comprehensions (new in Python 3.15) to write a function that flattens deeply nested lists of objects.
140
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 12/03/2026
That's a level around that diagram. Decorator with arguments is actually a decorator factory, so it'll be a function that contains this structure inside it :D
110
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 12/03/2026
Python decorators blueprint: a step by step explanation of the full decorator anatomy. Steal this for when you're writing your own decorators.
Diagram showing the full decorator anatomy and the 9 parts that make up a general decorator.
172
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 03/03/2026
Oh nice, that's better!
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
At least you managed to make it work! For a while, I couldn't do anything at all :P
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
Not sure I follow what you mean by “on normally spaced strings less replacing to do”. I like " {2,}" because it's easy to miss the double space in the original " +"... I'll replace it, thanks!
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
I wrote 0 blog posts in February. Today I already wrote 2. Go figure. 🤷
020
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
Came up with 4 random ways to do this. 2, I recommend you use them (although 1 doesn't work!) The other 2 are really cool — they use fixed points and `itertools.groupby` — but they'll be overkill 99.9% of times.
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
I meant “This is, shortEN runs of 2+ [...]”
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
It was a random thought, indeed. For a bit more context, see the second approach and how it doesn't work 100%: mathspp.com/blog/remove-...
mathspp.com
Remove extra spaces
Learn how to remove extra spaces from a string using regex, string splitting, a fixed point, and itertools.groupby.
110
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
Nope because if you have newlines, for example, those will disappear!
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 02/03/2026
How do you collapse runs of adjacent spaces in Python? That is, shorter runs of 2+ consecutive spaces so there's only 1 space there? I can't come up with a simple/straightforward way to do it with `str.join` and I'm surprised... What am I missing?
410
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 01/03/2026
Ok, obrigado!
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 28/02/2026
Pretty impressive! Annoying, but impressive! And do you have any idea of how much data you spent? In case something similar happens to me 😂 (My internet has been acting out.)
120
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 28/02/2026
Pode dar um exemplo de cada só para eu não ter de rever a série até perceber? 🙏
100
Reposted by Rodrigo Girão Serrão 🐍🚀
Anže @anze3db.pecar.me · 27/02/2026
Hey all! It's almost time for the next Python Lisbon Meetup! 🐍 On Thursday, pyctrl will be talking about exceptions. We'll cover the origin of exceptions, their usage in OOP, how best to manage them, and more. It's going to be exceptional! 💎
122
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 28/02/2026
How did it go? 😬
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 24/02/2026
Thanks for sharing! Neither star nor asterisk are usages that shock me. And yeah, sometimes it’s implied by the context, absolutely.
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 24/02/2026
Ahhhh that’s what you meant by McGugan boxes! Right :D thanks for the link
010
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/02/2026
That’s not what I meant with the question. _What_ are the McGugan boxes?
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/02/2026
Then what do you do after I type “def f(args)”?
100
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/02/2026
🤣
000
Rodrigo Girão Serrão 🐍🚀 @mathspp.com · 23/02/2026
Interesting... 🤔
000