Summary
Understanding and avoiding common Python anti-patterns will help you write cleaner, more efficient, and maintainable code.
First, we presented common Python code style violations. Then we discussed several anti-patterns that are related to correctness and can lead to bugs. Next, we covered practices that, beyond the code style itself, are not good for code readability and maintainability. Finally, we saw a couple of anti-patterns that one should avoid for writing code that has good performance.
Always remember – the best code is not just about making it work but also about making it work well. Even more, ideally, it should be easy to maintain.
We finally reached the end of this book. It was quite a journey. We started with the main design principles, then moved on to cover the most popular design patterns in the way they can be applied to Python, and finally touched upon Python anti-patterns. That’s a lot! The ideas and examples we discussed help us to...