Advertisement · 728 × 90

Posts by Rodrigo Girão Serrão 🐍🚀

Preview
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

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...

1 week ago 248 54 14 10

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.

1 week ago 1 0 0 0

Congratulations for all of the hard work you've been doing!

1 week ago 1 0 0 0

I forgot a semicolon and my site was down for ~4 hours without me even knowing.

The joys of programming. 😂

1 week ago 3 1 0 0

The REPL is a good one! 👍

1 week ago 0 0 0 0

This was ahead of Magritte's time :D

1 week ago 1 0 0 0

Thanks for educating me!

1 week ago 1 0 0 0

What is a “Magritte moment”?

1 week ago 0 0 1 0
Advertisement

What's your favourite vanilla Python feature?

(Abuses of the Python syntax are valid answers.)

1 week ago 0 0 1 0

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!

1 week ago 0 0 0 0
Preview
OpenAI to acquire Astral Accelerates Codex growth to power the next generation of Python developer tools

Astral just entered into an agreement with OpenAI to integrate their Codex team!

openai.com/index/openai...

1 week ago 0 1 0 1

Thanks! I do my best 🙏

2 weeks ago 1 0 0 0
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.

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.

Too many arrows?

2 weeks ago 4 0 1 0

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

2 weeks ago 1 0 1 0
Diagram showing the full decorator anatomy and the 9 parts that make up a general decorator.

Diagram showing the full decorator anatomy and the 9 parts that make up a general decorator.

Python decorators blueprint: a step by step explanation of the full decorator anatomy.

Steal this for when you're writing your own decorators.

2 weeks ago 7 2 1 0
Advertisement

Oh nice, that's better!

4 weeks ago 0 0 0 0

At least you managed to make it work! For a while, I couldn't do anything at all :P

4 weeks ago 0 0 0 0

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!

4 weeks ago 1 0 0 0

I wrote 0 blog posts in February.

Today I already wrote 2.

Go figure. 🤷

4 weeks ago 2 0 0 0

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.

4 weeks ago 0 0 0 0

I meant “This is, shortEN runs of 2+ [...]”

4 weeks ago 0 0 0 0
Preview
Remove extra spaces Learn how to remove extra spaces from a string using regex, string splitting, a fixed point, and itertools.groupby.

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-...

4 weeks ago 1 0 1 0

Nope because if you have newlines, for example, those will disappear!

4 weeks ago 0 0 1 0
Advertisement

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?

4 weeks ago 1 0 4 1

Ok, obrigado!

1 month ago 1 0 0 0

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.)

1 month ago 2 0 1 0

Pode dar um exemplo de cada só para eu não ter de rever a série até perceber? 🙏

1 month ago 0 0 1 0

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! 💎

1 month ago 2 2 1 0

How did it go? 😬

1 month ago 0 0 1 0

Thanks for sharing! Neither star nor asterisk are usages that shock me. And yeah, sometimes it’s implied by the context, absolutely.

1 month ago 1 0 0 0