Python Patterns

Python is my favorite language, and I have been writing it professionally for 14 year. Even though I have used it for so long, I keep improving and learning new tricks, both for Python and coding in general.

A share some of things I have learned in blog posts, shown below:

A drawing of a Lycodon Modestus snake from the Iconographic Zoologica collection. Python Patterns: Named Tuples
Sometimes I need to store an ordered dataset, but reference specific members from it. Named tuples in Python provide a clean way to do this!
A watercolor drawing of a Spectacled Caiman fighting with a False Coral Snake by Maria Sibylla Merian. Python Patterns: max Instead of if
I often have to loop over a set of objects to find the one with the greatest score. You can use an if statement and a placeholder, but there are more elegant ways!