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

David Cournapeau cournape@gmail....
Tue Jan 20 03:38:18 CST 2009

On Mon, Jan 19, 2009 at 5:01 PM, Marko Loparic <marko.loparic@gmail.com> wrote:
> Hello,
> Could you suggest links justifying the use of python instead of java
> for a scientific project?
> I work for a R&D departemnt of a large company. We develop
> mathematical models, some of them in python.

I think it depends on the context - lame answer, I know :)

Of course, for prototyping, there is little doubt that python is
essentially much better equipped than java, because of fundamental
language features such as dynamicity, concisness, etc... You say that
your team already use python, so I assume that knowing python is not a

I love python for scientific programming, I think it is a huge step
compared to similar things, like matlab and co. But there are many
researchers I will never recommend python, yet: it is not well
integrated (and never will be as well as matlab, if only because each
package in the python stack are developed by different people with
overlapping but different goals), it is more difficult, and it is
different. Those aspects may be important or not. They don't matter to

Concerning the speed issue, I think it is very misleading to say there
is no speed problem in python. There are still too many cases where I
need to code into cython and/or C for acceptable speed of some
algorithms. As good as those tools are (they are certainly better than
the equivalent in matlab, for example), they are fundamentally a
failure of python in my mind. People in Lisp or OCAML communities
almost never code in another language, at least not as often as we do
in python - things like the Stalin compiler for scheme can generate
code as good as optimized C, we have nothing remotely comparable in
python. Java has gained a lot of speed the last few years, and is now
relatively competitive with C. I know, those comparisons are always
flawed, but then such is a comparison saying python is as fast as
java. Some fundamental aspects of python -like function calls - are
much slower in python than in java.

There is really a fundamental tradeof between power, expressiveness
and availability of tools/community to the task. When I started my PhD
and looked for something different from matlab, I took some time
considering both Ocaml and python. I thought Ocaml was a better
language - and still think so, although I did not realize at that
point of powerful dynamic typing is. But python is much more readable
- and scientific code, at least in academia, is as much a
communication tool as an implementation tool IMHO. And python is more
known, has bigger community, is simpler - not all researchers are
computer scientists. Java is at the other end of the spectrum compared
to Ocaml, in some way - depending on the situation, I can imagine that
I would have to chose Java (or god forbids, C++).

In other words, python is not the best language, is not the fastest
language, is not the coolest, does not have all the best numerical
algorithms. But it is a pretty damn good tradeof between all those
points, the best I know of today, at least for my use of it,



More information about the SciPy-user mailing list