An initial version of this article appeared as a Pybites email first. If you like it join our friends list to get our valuable Python, developer and mindset content first … How following the Zen of Python will make your code better, a lot better. This epic set of axioms (triggered by typing import this in the… Continue reading Reflections on the Zen of Python
Articles on Best Practices
Tips for clean code in Python
By Bob Belderbos on 8 November 2022
In this article I will give you 10 tips for cleaner code. Hope this helps improve your Python code. 1. Smaller units. Break long functions (methods) into multiple smaller ones that do one thing (SRP or “Single-responsibility principle”). This will make your code more modular and easier to test. For example, a function that parses… Continue reading Tips for clean code in Python
Help, I need to refactor a mega class! Here are 5 tips …
By PyBites Team on 24 September 2022
Somebody asked the other day for tips on how to refactor a mega-class? It was actually one of the first tasks on the new job, ouch! A single class, several thousands lines of code, no tests available 😮 You might scratch your head and say WTF?! After all, good developers decouple code into manageable pieces… Continue reading Help, I need to refactor a mega class! Here are 5 tips …
Single or double quotes in Python?
By Bob Belderbos on 20 September 2022
Whatever you think about Twitter these days, it’s pretty handy for us developers to ask questions and get inputs 💡 Last week I asked about single vs double quotes in Python: I thought double quotes were a given, black – “The Uncompromising Code Formatter”, defaults to them and I personally find them pleasant to the eye.… Continue reading Single or double quotes in Python?
10 Tips to Write Better Functions in Python
By Bob Belderbos on 19 January 2022
In today’s article 10 tips to improve the quality of your Python functions.
5 tips to speed up your Python code
By Bob Belderbos on 21 February 2017
In this post I will give you 5 tips to speed up your code.
Errors should never pass silently
By Bob Belderbos on 18 January 2017
In this article some important anti-patterns regarding error handling and how to solve them making your code more Pythonic and easier to maintain.
Beautiful, idiomatic Python
By Bob Belderbos on 10 January 2017
Transforming Code into Beautiful, Idiomatic Python is a must-watch to write more Pythonic code. In this post some highlights.
5 min guide to PEP8
By Bob Belderbos on 2 January 2017
Today a post on PEP8, the Style Guide for Python Code