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.
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.
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.
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.
It's a wrapper around a script I made the other day to benchmark code quality ->
It's a wrapper around a script I made the other day to benchmark code quality ->
I only needed the worst N files / most complex N functions…
but the code was doing a full sort and then [:top_n].
I only needed the worst N files / most complex N functions…
but the code was doing a full sort and then [:top_n].
`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.
`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.
✅ 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.
✅ 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.
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.
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.
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 🐍 😍 📈
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 🐍 😍 📈
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).
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).
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.
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.
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
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
Here `issubset` reads as:
"Are all required checks contained in what’s done?"
Here `issubset` reads as:
"Are all required checks contained in what’s done?"
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:
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:
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? 👇
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? 👇
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 👇
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 👇
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. 🚀
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. 🚀
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`)
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`)
This week I learned that uuid now supports v7 and that random + sqlite3 added command-line scripts in recent versions.
This week I learned that uuid now supports v7 and that random + sqlite3 added command-line scripts in recent versions.
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 😍 👇
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 😍 👇