Topic: Python
I LOVE Python. I have been writing it professionally since 2005, and it was the first programing language I became proficient with. My best practice articles and others on the subject of Python are below:
Python Patterns: Map and Filter
For loops are great, but I am a big fan of replacing them with simple functions. Python provides a couple of building blocks.
For loops are great, but I am a big fan of replacing them with simple functions. Python provides a couple of building blocks.
Using Travis Build Stages to Test Multiple Python Versions and Publish to Pypi
Often when building packages, we want to test against multiple versions of the language, and then build the package once. I will show you how to accomplish this using Travis Stages.
Often when building packages, we want to test against multiple versions of the language, and then build the package once. I will show you how to accomplish this using Travis Stages.
Python Patterns: @total_ordering
Your classes can make use of the rich Python comparison operators just like the built-in classes. Here I'll show you how to do it while minimizing boilerplate.
Your classes can make use of the rich Python comparison operators just like the built-in classes. Here I'll show you how to do it while minimizing boilerplate.
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.
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!
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!
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!