[Numpy-discussion] converting IDL to python

Mark Fardal fardal at coral.phys.uvic.ca
Tue Dec 18 19:40:01 EST 2001


earlier this month Joe Harrington posted this:

  NASA's immediate objective will be a complete data-analysis system to
  replace IDL, in short order, including an IDL-to-python converter
  program.  That shouldn't be hard as IDL is a simple language, and PyDL
  may have solved much of that problem.

I'm an IDL user, and I'm currently trying to see if I can switch over
to python.  It strikes me that an IDL-to-python converter program is a
VERY ambitious idea.  While IDL's syntax is rather similar to Python,
and less powerful (so that there is less to translate), there are
enough differences between them that conversion is probably not a
simple task.  For example, in IDL:

  arguments are passed by reference
  array storage order is different
  there's a different notion of "truth" than in Python
  a structure type exists, and a notation for slicing arrays of structures
  trailing "degenerate" array dimensions are truncated in a hard-to-predict way
  array subscripting generates copy, not reference

I'm sure there are some other big differences too.  

Then there is major functionality in IDL that is missing in Python. *
(Like plotting. :-)  It's hard to translate a routine when you have
nothing to translate it to.

I've looked at PyDL.  It seems a nice little crutch, and it makes the
learning curve a little shallower for people converting from IDL to
Python.  It's very far from being a complete translation from one
language to the other.

I don't know what Joe had in mind for a converter program.  One that
took care of braindead syntax conversion, while leaving the more
difficult issues for a human programmer to translate, might not be too
hard and could be pretty useful.  I think it would be a bad idea to
hold out for something that automatically produced working code.

my $.02 (worth only $0.0127 US)
Mark Fardal
University of Victoria

* I'm stuck in Python 1.5 until the New Year, so have yet to see what
SciPy has to offer.  Maybe SciPy-Sumo is getting close.

More information about the NumPy-Discussion mailing list