Python for Fortran programmers II: why Python?

Python is a general-purpose language, used in extremely different fields. Take a look at http://wiki.python.org/moin/PythonProjects Many of the projects are available at the Python repository PyPI. That means the language is active and adequate for many applications. But of course, we want it to be also good at number crunching and data visualization.

For that you need some packages. Packages are extensions of the core language, a kind of library in Fortran. They need to be imported before they are used. Some packages are a must for scientists: numpy, matplotlib and possible, scipy. Installing python packages is easy. I will explain that in the future, but these three packages are on most Linux repositories (certainly in Ubuntu) and that is the simplest way to install them.

Because python is an interpreted language (It’s gonna be very slow!! Wait, wait…) you can use different ‘shells’. I recommend iPython. That, together with the previous packages, turns python into a powerful scientific development tool. If you have time (I promise to keep this post short) watch this amazing talk by Fernando Perez, the author of ipython:

http://www.youtube.com/watch?feature=player_embedded&v=F4rFuIb1Ie4#!

If you are still not convinced, take a look at this survey which compares Python to Fortran:

http://hammerprinciple.com/therighttool/items/python/fortran

Convinced? Then start by typing import this and start absorbing the Zen of python. Then impress your colleagues by defying gravity with import antigravity (only in Python 3). Aha! You look more pythonic now…

If you are new to Python and want to install it you will have to decide whether to use Python 2 or Python 3. In the next post we will see how to make this decision. The short answer is ‘use Python 3’.

Advertisements

Tags: , , ,

About Ramon Crehuet

I'm a Computational Biochemist working at the IQAC institute of the Spanish National Research Council (CSIC)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: