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:
| Python Patterns: Enum |
Things often come in sets of specific items, like states, Pokémon, or playing cards. Python has an elegant way of representing them using enum.
| 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!
| 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!