Python advocacy in scientific computation
Steve Holden
steve at holdenweb.com
Sun Mar 5 21:08:29 EST 2006
sturlamolden wrote:
> Robert Kern wrote:
>
>
>>And you need to ask why Python is a better Matlab than Matlab?
>
>
>
> First there are a few things I don't like:
>
> 1. Intendation as a part of the syntax, really annoying.
>
Troll. You think this is going away because *you* don't like it? Am I to
presume that you don't bother to indent your C code according to its
nested block structure? If you *do* indent your C code, perhaps you can
explain the additional benefits of the braces?
> 2. The "self.something" syntax is really tedious (look to ruby)!
>
This is done because of a preference from explicit references over
implied ones. It does avoid a lot of namespace confusion.
By the way, anyone who can't count shouldn't be criticising programming
languages. What happened to "3"?
> 4. Multithreading and parallel execution is impossible AFAIK because of
> the so-called GIL (global interpreter lock). Matlab is perhaps even
> worse in this respect.
>
Right. So kindly tell us how to write thread-safe code without using a
GIL. This is not an easy problem, and you shouldn't assume that all you
have to do to get rid of the GIL is to wave your magic wand. There are
deep reasons why the GIL is there.
> 5. I don't like numpy's array slicing. Array operations should be a
> part of the language, as in Matlab, Fortran 90, Ada 95, D, Octave.
>
Slicing *is* a part of the language, inserted into the grammar (as far
as I know) precisely to support the numeric/scientific community.
>
> And there is a couple of questions I need answered:
>
> 1. Can python do "pass by reference"? Are datastructures represented by
> references as in Java (I don't know yet).
>
All assignments store references.
> 2. How good is matplotlib/pylab? I tried to install it but only get
> error messages so I haven't tested it. But plotting capabilities is
> really major issue.
>
Good enough to keep you away, apparently ;-) (Sorry, I don't use these
features).
> 3. Speed. I haven't seen any performance benchmarks that actually deals
> with things that are important for scientific programs.
>
The major fact here is that no matter how fast a language is there is
always a need for more speed in certain areas.
Suffice it to say that Python is being used for a wide range of
scientific and engineering problems to the evident satisfaction of its
users.
> 4. Are there "easy to use" libraries containing other stuff important
> for scientific programs, e.q. linear algebra (LU, SVD, Cholesky),
> Fourier transforms, etc. E.g. in Matlab I can just type,
>
> [u,s,v] = svd(x) % which calls LAPACK linked to ATLAS or
> vendor-optimized BLAS
>
> Even though the language itself is very limited this type of library
> functionality more than makes up for it.
>
The more people who join in and write libraries to add to the growing
corpus of scientific and engineering libraries the sooner the answer to
this question will be "we have everything you want".
For the moment, however, since apparently Google isn't available where
you are, a quick search for "Python LAPACK" gave
http://mdp-toolkit.sourceforge.net/faq.html
as its first hit. This appears to include information about how to have
LAPACK make use of ATLAS' faster LAPACK routines. Satisfied?
>
> I have looked for alternatives to Matlab for quite a while, mainly due
> to the cost, the åpoor speed and poor memory management. I am not sure
> it is Python but so far I have not found anything mor promising either.
>
You know, recently the Python community has acquired a reputation in
certain quarters for defensive support of the status quo. With
ill-informed criticism like this from self-confessed beginners it's not
hard to see how this myth has arisen.
I'd be very surprised if Python doesn't already give you 95% of what you
appear to want. If you prejudices about indented code and self-relative
references blind you to the clear advantages of the Python environment
then frankly you are a lost cause, and good riddance.
If, on the other hand, you are prepared to engage the community and do a
little bit of learning rather than just trolling, you may find that one
of the most valuable features of Python is its supportive user base,
whom at the moment you seem to be doing your best to offend.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com
More information about the Python-list
mailing list