[Edu-sig] Why choose Python (subtitled: the lure of the tool)

David Boddie david at boddie.org.uk
Thu Oct 20 02:01:03 CEST 2005

On Wed Oct 19 10:25:12, Peter Bowyer wrote:

> As you may remember from previous posts, I am researching ways to 
> improve the teaching of programming to physics students.


> My idea was to teach the basics using Python and scientific 
> modules.  However, the question I am consistently coming up against 
> is "Why not teach the students Matlab?".  It's a very good point and 
> one I can think up no clear answer for.  If the students stay in 
> Physics or a related field they will be using Matlab (and 
> C/C++/Fortran if needed).  therefore is there any reason not to teach 
> this as the introduction to programming?

The question is: would you use Matlab in an introductory programming
course for students in other disciplines? I think it's worth separating
general programming skills from computational techniques.

> My arguments at present are that Matlab is a proprietary tool so the 
> cost to students in obtaining copies will be not inconsiderable 
> (considering it will only be used for a short course), and that 
> Matlab is a specialised tool, so those not interested in going on 
> into a physics related field will not find it of any use (unlike Python).

I think these are both strong arguments against it, though you might
find some resistance to the second. After all, these students are being
educated as physicists in the assumption that at least some of them will
stay in the profession.

> The arguments for Matlab are stronger:
> 1) It's a standard tool, widely used
> 2) It is easier to install and maintain (discounting the Enthought 
> edition for a moment, Python is CRAP compared with other langauges - 
> where is the Package manager to make life easier?)

Are you talking about distributions of the actual language runtime and
standard library, or installing packages, or something else?

> 3) The editor has a good interface (v7 and above) which IDLE lacks 
> (no data inspector 'right there')
> 4) Integrated help for all the scientific functions

It sounds like you need some kind of IDE, with possibly specialized
support for scientific or mathematical computing. I'm afraid I'd can't
suggest one for Python, although I'd be interested in hearing just
which features you think it would require.

> Are there any reasons you can think of that Python makes a better 
> choice than Matlab?  I myself would far rather use Python (I have 
> ideas about how VPython can help the students understand Python) but 
> need a more robust reason than a handwaving argument about 
> "3D...easier for students to visualise...".

I keep coming back to the licensing issue. The most motivated students
will want to experiment in their own time. If they have to spend that
time in a computer lab then that might impact their motivation.

> Toby Donaldson made a good point in his post on 17/10/05:
> >It's not so good for talking about "programming as exploiting your
> >computer", i.e. when it comes time to implement an algorithm
> >*efficiently*.

You can still learn about efficiency in Python. The result just might not
be as fast as you would like. :-)

> The people doing my course know absolutely nothing about programming, 
> but at the same time being physics, every member of staff mentions 
> efficiency in the same sentence as programming :-)  With that said, 
> now the grounds are switched from teaching C/Python to Matlab/Python 
> it doesn't appear to be such a valid argument.

I don't believe that I was all that great at physics or mathematics at
university, but I found that I enjoyed experimenting with different
programming languages.

As a physics student, I was initially taught Pascal, then Fortran, and
finally 8086 assembler and the language used in Maple, but none of these
have been particularly useful. Later on, I needed to use Matlab and found
my way to RLaB, which I'm happy to see has recently been brought back to
life as a different project:


In the end, I went from RLaB to Python precisely because Python is a more
general purpose and extensible language. For anything that required
intensive computation, I used C with the help of the Numerical Recipes book
and processed the results with Python. In an ideal world, I'd have used
an ODE solver from Python.

To conclude, I'd say that Python gives you lots of opportunities to
experiment with non-scientific libraries and tools (such as GUIs and web
interfaces) while still supporting some scientific computing. Matlab may
cover the scientific domain more extensively, but it might be tricky to
integrate with other tools (assuming that you have the time and inclination
to explore that avenue).

I still think that RLaB is worth checking out. Although it didn't have
the integrated environment that you presumably get with Matlab, I seem to
remember that it was fairly nice to use, and it provided some reasonable
basic visualization (plotting) facilities.


More information about the Edu-sig mailing list