Python less error-prone than Java

Christoph Zwerschke cito at online.de
Sun Jun 4 05:12:09 EDT 2006


>> Simon Percivall wrote:
>>> First: It's perfectly simple in Java to create a binary sort that
>>> sorts all arrays that contain objects; so wrong there.
>> My point was that the *same* Java source example, directly converted to 
>> Python would *automatically* accept all kinds of arrays.
> 
> And the same code converted to SML would automatically work on all
> kinds of arrays and SML is statically typed.  It's a language issue,
> not a typing issue.

Ok, here the point was that Java has *explicit* static typing. SML is 
not a procedural language and uses *implicit* static typing. Therefore 
it shares some of the benefits of dynamically typed languages such as 
Python. However, an SML version of the program would probably still have 
the same bug as the Java version, right?

>> No need to make any extra efforts.
>> By the way, how would you do it in Java? With 
>> function overloading? I would not call that perfectly simple.
> 
> Since Java doesn't allow function overloading that clearly can't be
> the way.  J2SE 5.0 allows generic classes and functions that operate
> on generic containers.  There are some gotchas, but it's not drastically
> more complex than the original int-only java code.

Java doesn't allow function overloading? That would be new to me. Or did 
  you just want to nitpick that it should be more properly called 
"method overloading" in Java? And as you already said, there are some 
gotchas and you would have to wrap int and long etc. I still would not 
call that perfectly simple, as it is in Python.

-- Christoph



More information about the Python-list mailing list