Posts tagged "python"

Flavio Curella

Dataclasses and attrs: when and why

Python 3.7 introduced dataclasses, which design is based on the "attrs" library. This article will show the way I use dataclasses and attrs, why I think you should use both, and why I think attrs is still very relevant.

Flavio Curella

Pro-Tip – Sentinel values in Python

It is often necessary to differentiate between an argument that has not been provided, and an argument provided with the value `None`. For that purpose, we create what's called a 'sentinel value'.

Flavio Curella

Today I Learned – Caching uuid's for the win!

More and more often, we see schema designs that use UUIDs as primary keys. That's a valid choice if you're concerned about sharding and partitioning your database, but it has its own drawbacks, sometimes in unexpected places.

Frank Wiles

Pro-Tip – Python 3 run command over SSH

Sometimes you just need to run a command on a remote host with ssh and Python 3 without any real fuss. Here is the simplest way we have found to do that and retrieve the output. 

Frank Wiles

Pro-Tip – Python: atexit

Python's atexit handler is one of those things people should use more often.  Some developers aren't even aware that it exists and that makes me sad.