Bob Belderbos
banner
bbelderbos.bsky.social
Bob Belderbos
@bbelderbos.bsky.social
Co-founder @pybites.bsky.social. Python developer & coach helping devs level up with project-based learning & modern Python. Start here → https://pybit.es
Advent of Code solving is one thing — the real 2–3× value is in refactoring afterwards, finding new creative ways of doing things. 💡
December 16, 2025 at 4:00 PM
We are all AI developers now in a sense ...

The game has changed. With AI handling more routine coding tasks, the developers who will lead the future are the ones who can transcend their traditional role.
December 15, 2025 at 2:43 PM
jq is really cool for ad-hoc JSON inspection/ parsing (of course use Python when it turns into more of a program) ->
December 12, 2025 at 2:54 PM
Set operations are so concise in #Python 🐍😍

Here's a neat way to get the characters that appear in every group 👇

`set.intersection(*...)` returns the items that exist in all given sets. It can take multiple sets as args, which we "splat" (`*`) unpack from a gen expression.
December 11, 2025 at 8:41 AM
TIL that >= #python 3.10 you can call `total()` on a Counter object:
December 11, 2025 at 8:39 AM
I built my first TUI for the @pybites monthly code challenge, I really like Textual so far! 🚀

It's a wrapper around a script I made the other day to benchmark code quality ->
December 5, 2025 at 11:05 AM
Refactoring win from a Codeflash the other day 👇

I only needed the worst N files / most complex N functions…
but the code was doing a full sort and then [:top_n].
December 4, 2025 at 3:00 PM
Refactored a long if/elif ladder into match/case the other day 👇

`case 1 | 2` groups opcodes that share behavior

`case 5 if part2` keeps the extra condition right next to the logic ("flat is better than nested")

Feels more like a clean dispatcher than a pile of conditionals.
December 3, 2025 at 3:00 PM
Writing your own list chunking helpers? Check out #Python’s `itertools.batched()` that can do this for you 🚀

✅ Works with any iterable.
✅ Handles a smaller final chunk automatically.
✅ Use `strict=True` (Python 3.13+) to raise a `ValueError` when the final batch isn’t full.
December 2, 2025 at 2:00 PM
Then we rewrote it using a simple stack 👇
November 30, 2025 at 3:00 PM
From messy to clean numbers with `removeprefix` / `removesuffix`

With `removeprefix("$")` and `removesuffix(suffix)` you strip only what you *expect* to be there, then `float(cap) * multiplier` does the rest.

Classic EAFP: try to parse, fall back to `0.0` when the data is junk.
November 29, 2025 at 1:00 PM
Cool debugging trick I picked up from this article:

Django bulk_update memory issue
blog.pecar.me/django-bulk...

Logging memory usage in #Python using `psutil` - example below 👇

Bonus: comparing list comp vs gen expression 🐍 😍 📈
November 28, 2025 at 1:00 PM
Really enjoyed my chat with Kishan Patel on our @pybites podcast.
November 27, 2025 at 12:17 PM
Python tip 🐍 itertools.groupby() for the win 🧠

Context: I was solving an AoC which required a valid password to have a digit that appeared in a run of exactly two (not part of 111 or 2222, etc).
November 26, 2025 at 3:00 PM
My favorite one though: "Rust is like a critical spouse" - it's a bit lengthy so AI summary 👇

From the book:
> Rust is as strict as possible at compile time, where you, the programmer, live. So Rust teaches you as much as it can about your program before you even run it.
November 25, 2025 at 1:00 PM
I needed to see which packages were pulling in six.

Two ways:

- uv tree --package six --invert → quick “who depends on this?” from uv.lock

- uv pip tree --package six --invert --show-version-specifiers → more pipdeptree-style, constraint-aware view from the actual env
November 23, 2025 at 1:00 PM
I love `all()` but sometimes a set operation is more succinct in #Python

Here `issubset` reads as:

"Are all required checks contained in what’s done?"
November 20, 2025 at 11:00 AM
From explicit to declarative / expressive #Python

Had a super cool ensemble coding session today solving the “Analyze stock data” Bite. 🚀

It was a great reminder of how far you can refactor a function by leaning on built-ins 🐍

Here’s how our final function evolved:
November 19, 2025 at 4:21 PM
`itertools.pairwise()` 🐍 use case: detect (and forbid) consecutive characters that are the same👇

>>> list(it.pairwise("hello"))
[('h', 'e'), ('e', 'l'), ('l', 'l'), ('l', 'o')]

#Python #tips
November 17, 2025 at 1:11 PM
A script for everything 📈

A bad habit among us programmers: going without breaks. 😅

But the body reminds us: back pain, dry eyes, tension.

So why not use our coding chops to fix that? 👇
November 15, 2025 at 11:00 AM
One of my favorite design patterns: the Repository Pattern. 😍

It keeps business logic separate from the data layer. 📈

Need to swap SQL for CSV or add an API backend later? Plug it in, the interface stays the same.

Example below 👇
November 14, 2025 at 10:38 AM
I solved a Bite today and used collections.Counter() 🙂

Good reminder: the right data structure saves a lot of code. 🐍

In this case: apart from a small helper function, you get the top stock by symbol using most_common()

Clean, fast, readable. 🚀
November 13, 2025 at 5:29 PM
So keep an eye out on the docs to expand and challenge your Pytohnic thinking. 📈

Bonus tip below: how to un-lambda yourself.
I agree: just write a quick function, more readable + reusable (with the exception of using it inline in common built-ins like `sorted`)
November 12, 2025 at 10:39 AM
I like #Python books and reading source code for inspiration, but don't underestimate the power of the docs.

This week I learned that uuid now supports v7 and that random + sqlite3 added command-line scripts in recent versions.
November 12, 2025 at 10:39 AM
TIL #Python 3.14 comes with uuid6 and -7

And really nice: since 3.12 the uuid module can be executed as a script from the command line 📈 - so with a bit of uv we get to a pretty powerful command 😍 👇
November 11, 2025 at 11:55 AM