[Numpy-discussion] matlab vs. python question

Sturla Molden sturla@molden...
Wed Apr 25 14:29:14 CDT 2007

On 4/25/2007 8:34 PM, Robert Kern wrote:

> The things that I get annoyed with every time I have to read some Matlab code
> are the lack of namespaces and first-class function objects.

Matlab does have first-class function objects. You can get a handle to 
any function using the @ operator. Matlab has closures as well.

function f = addn(n)
    tmp = n
    function y = closure(x)
       y = x + tmp
    f = @closure

The most recent version of Matlab also have classes and namespaces 
implemented properly - not like the old broken Matlab objects. But I've 
never used it as I have stopped paying for maintenance of my Matlab 
license - I use Python anyway. But if it weren't for NumPy, SciPy and 
Matplotlib, I would probably still be using Matlab.

As a programming language Matlab is very weak compared to Python. Matlab 
is to Fortran what Python is to Lisp. As an advanced desktop calculator 
Matlab has the edge. But that has more to do with the interactive 
environment and available toolboxes than the language it self. It is 
also easier to write C or Fortran extensions for Matlab than for Python.

Sturla Molden

More information about the Numpy-discussion mailing list