Python fo Numerical Programming (was Re: How to get into Scientific Programming)

From: Louis Pecora (pecora_at_anvil.nrl.navy.mil)
Date: 10/24/03


Date: Fri, 24 Oct 2003 15:39:02 -0400

In article <bnbt6e$8kp$1@hood.uits.indiana.edu>,
 glhansen@steel.ucs.indiana.edu (Gregory L. Hansen) wrote:

> Since you brought it up, what's to recommend Python over Perl, C, or
> Fortran for doing whatever it is that Python does well?
>

We're going a bit off topic so I started a new thread:

I have become an avid Python user. I never used Perl, but have
programmed plenty in Fortran and C and C++. Python is GREAT for quick
development. Very nice of scientific numerical work and experimenting
with new numerical schemes. It is not as fast as Fortran and C in
general, although there are C-based libraries that are easy to call that
do run fast (see Numeric.py for example). You can also extend Python
with your own C routines.

Python is a clean, simple, fairly straightforward OOP language that is
very nice to develop in. The usual cycle of Edit, Compile/Link, Run,
Debug is short-circuited some and is very fast. Python is interpreted
and has lots of built in checks. When you make a mistake it leads you
to the offending line, you correct it and hit run and off you go again.
Very nice. It has caught on in some scientific circles. Some use it in
place of MatLab since it is claimed to be easier to program than Matlab
(I have no experience there), but MatLab has much better Plotting.
Python plotting is coming along as new Open Source packages become
available, but MatLab leads there from what I've seen. I used to use
Mathematica for numeric stuff and it's not bad, but debugging big
routines in Mathematica is a nightmare. Just the opposite with Python.
So I switched about two years ago.

Given my choice among Python, Fortran, C, C++, Basic, Mathematica, and
APL, all of which I have used for numeric programming, I would choose
Python in a flash.

YMMV



Relevant Pages

  • Re: calling a function that returns a c_char from python
    ... compiler used, the output in python is right or wrong. ... The problem could lie either on the python side or the Fortran side. ... character arguments was defined in f77. ...
    (comp.lang.fortran)
  • Re: New to Python: Features
    ... > compile-time checking of procedure calls) were fixed in Fortran 90. ... alternative language possibilities for my employer of the time, ... By directly attacking pyrex as "not mature", ... > language like Python is good old C. ...
    (comp.lang.python)
  • Re: Python for Fortran programmers
    ... proposition for Python in the Fortran community", ... compiled language such as Fortran or C++, but I would still prefer to ... greater number of programming errors that are typically detected by a ...
    (comp.lang.fortran)
  • Re: Fortran vs Python - Newbie Question
    ... I've been told that Both Fortran and Python are easy to read, ... creating number crunching apps over Fortran?? ... serious numerical computation these days is large-scale) without ...
    (comp.lang.python)
  • Re: python for a matlab user
    ... Having recently done a bunch of Fortran to Matlab and Fortran to Python ... need to look at is the way the declaration part of loops are written ...
    (comp.lang.python)