Without compilation, how to find bugs?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Thu Oct 13 20:04:13 EDT 2016


On 14-10-2016 1:07, pozz wrote:
> All the tricks have a common goal: to discover bugs as soon as possible, mostly during
> compilation process. Indeed I usually find some bugs during compilation (or static
> analysis). It seems to me very important.

I wanted to reply a bit more to this paragraph as well.

I agree that finding bugs as soon as possible is nice, but the thing to keep in mind is
that the kind of bugs you find during compilation are almost always syntactic errors,
typos or other simple mistakes. I think semantic and logic errors are usually the ones
that have the biggest impact and take by far the most time to debug and fix. These bugs
mostly cannot be detected by compilers anyway. A syntactically valid program can do
something completely bogus (and almost always does because humans make mistakes when
designing and building it)

In my personal experience I find that I make a lot LESS syntactic errors and simple
mistakes in Python than in other languages. Mostly because Python produces very clear
and concise programs when compared to other languages (especially languages as low level
as C).  A function of 30 lines in Python has a lot less chance to have a bug than an
equivalent function that requires 300 lines to write elsewhere.

Bottom line: >I< don't really need static compiler checks when working in Python.  I do
miss them sometimes when refactoring stuff, but that's where a solid unit test suite
comes to the rescue.


Irmen




More information about the Python-list mailing list