Python less error-prone than Java

"Martin v. Löwis" martin at v.loewis.de
Mon Jun 5 04:11:50 EDT 2006


Ilpo Nyyssönen wrote:
>> Buggy library code is what prompted that article.
> 
> Yes, but it is an error type that happens very rarely still. And so it
> seems that very few programs even notice that bug in that library. 

That's certainly the case. The bug went unnoticed in the Java library
for nearly a decade, despite Java being used fairly widely.

The OP's point is not that the bug might be "minor": the point is that
an algorithm who was studied hundreds of times in computer science
courses, repeated many times in the literature, and proven "correct"
many times, still is wrong, and that the error primarily arises from
using a type declaration.

> If the input value range is limited, you want to get an error, if out
> of range value is given. If you want to handle unlimited values, you
> really need to take a look that you can do it. Think for example
> storing such value to a database.

So the real design flaw in Java is that int addition doesn't raise
exceptions on overflow? That wouldn't have helped - the algorithm
still would have been wrong, and people still would have noticed
only when it happens (just as they get an exception now: array index
out of bounds)

Regards,
Martin



More information about the Python-list mailing list