People often ask me about improving the performance of their Python code. They even sometimes complain about Python being slow overall. This complaint often stems from the fact that people tend to use Python quite naively, without realizing the performance impact of certain constructs.
While optimization and performance tuning of existing code is important, there are some things to keep in mind while writing Python code. These things will let you avoid your code being unnecessarily slow in most cases.
In this post, we're going to take a bit of a dive, and look into how Python executes code; into functions and functional programming through the lens of performance.