[SciPy-user] python (against java) advocacy for scientific projects

Sturla Molden sturla@molden...
Tue Jan 20 08:17:17 CST 2009


On 1/19/2009 8:58 PM, Ravi wrote:

>   The advice from Mr. Molden is well-argued, but he does gloss over a few of 
> the difficulties. These serious problems are also present in Matlab & Java for 
> the most part.

(this was actually written yesterday, but posted incorrectly.)


If you insist on using titulation, that is Dr. Molden to you.  :-P

There are a number of things to consider when comparing Python/NumPy 
with Matlab. But I was not comparing Python with Matlab. I was comparing 
Python with Java.

I retain that Java is not fit for scientific computing. There are no 
complex number primitive, no flexible array primitive, and no operator 
overloading. Try to pass an array slice to a function: It's not 
possible. One has to implement an array class to do that, and you end up 
with syntax like

    arr.set(idx, value)
    arr.set(idx, array.add(arr1,arr2))
    foobar(arr.get(idx))

instead of:

    arr[idx] = value
    arr[idx] = arr1 + arr2
    foobar(arr[idx])

Because Java is statically typed (not duck-typed like Python and 
Matlab), you end up with ugly C++ like templates for generic functions.

C++ template metaprogramming is fantastic if you want to write 
unmaintainable code. Hey it's even proven to be a Turing complete 
'language'! But why go through all of that pain just to match the 
performance of good old Fortran? I known an easier way ... just write 
Fortran instead.

S.M.



More information about the SciPy-user mailing list