So if i write unit tests, that increases the number of lines of code, thus increasing the bug count right? The static type information in java is more akin to unit tests than actual programming logic - they decrease the bug count, not increase it.
Whether they decrease the bug count enough to make up for the productivity loss is the part that is debatable
In my experience, done right it's a bit of a wash. There's more potential cases to test in python.. but the tests are easier generally to write, and the code is more concise and easier to read.
With pretty extensive experience at this point in both languages I wouldn't say I've experienced a significant difference in bug trends at all, frankly.
I don't believe it is a simple linear relationship otherwise we'd all be using Perl or APL. More likely there is a "sweet spot" in the verbosity/terseness spectrum that is occupied by languages like Python.
This is not the case for Perl & APL: each line can contain a multitude of clauses and the relationships between them can be complex to unravel.
Conversely some languages (e.g. at the extreme end assembly language) require multiple lines to express a complete clause.
Complex manually expressed type systems can be similar in effect to both cases. A single line can become complex to unravel e.g this kind of thing:
int (*(*vtable)[])();
Reading complex regular expressions also exhibit similar problems in deciphering. Hence in Perl they are often broken over multiple lines with /x.We seem naturally drawn to using lines as logical delimiters: code is maybe similar to poetry in this respect. Also, in similarity to poetry, single clause lines allow us to annotate our thinking on the same line by way of a comment.
One clause per line is probably a natural sweet spot.
If my theory is correct then the relationship between lines and bugs will still be linear but APL would have a multiplier greater than one while assembly's multiplier could be a fraction (e.g. 5 vs 1/5).
Does that apply cross-language, or just within a given language?
Getting normal things done with static type checking is not always simple; sometimes code gets skewed toward satisfying the type system. This is not completely unlike the way some people pepper their code with statements that serve no purpose except to shut up a lint tool, or make their test code simpler by making their solution code more complex.
Assertions are an interesting case, as the programmer controls what gets verified and when, rather than being forced to code around an inflexible static checking system that inserts itself into language syntax.
Java is for better or worse more verbose than Python, which means more lines of code which means more opportunity for bugs. It is hardly nonsensical. That opinion is a product of language-centric parochialism with no regard for actual fact.
Ditto for the "just work" line being a "delusion." Like it or not, Python does indeed "just work" in most cases. This isn't unique to Python of course, but I do think that is a fair opinion of the author to hold.