What's the best way to minimize the need of run time checks?

Russell Owen rowen at uw.edu
Thu Aug 11 14:56:57 EDT 2016


On 8/10/16 3:44 PM, Juan Pablo Romero Méndez wrote:
> As to why I asked that, there are several reasons: I have a very concrete
> need right now to find pragmatic ways to increase code quality, reduce
> number of defects, etc. in a Python code base. But also I want to
> understand better the mind set and culture of Python's community.

I am late to this thread, so my apologies for duplicated answers, but I 
have two concrete suggestions:
- Unit tests. These are a hassle to write, but pay huge dividends in 
robustness of your existing code and making it safer to modify the code 
later. There are also tools to measure test coverage which are worth 
considering. I don't think it is possible to write robust code in any 
language (even compiled languages) without a good test suite.
- Always run a linter such as flake8. Most source code editors can be 
configured to do this automatically. This will not catch everything that 
a compiler would catch in a compiled language, but it will catch many 
common errors.

-- Russell




More information about the Python-list mailing list