[SciPy-User] Porting code from IDL to Python - 'Common block' equivalent?
Fri Jul 23 12:16:04 CDT 2010
On Jul 23, 2010, at 12:41 PM, Christopher Barker wrote:
> David Andrews wrote:
>> Now it's just a matter of converting ~13k lines of IDL into python :D
> A little piece of advice here -- I would resist the urge to "convert"
> your code line by line, or even function by function.
> I'm not familiar with IDL, but I do know that you will be much happier
> in the long run with a code structure that is natural in Python. IIUC,
> IDL is an array-oriented language, so that part will hopefully be a
> natural transition, but from the sounds of it the overall code
> may need to be quite different.
> So, think about the project as a whole, and how it can best be
> structured in Python, and start from there.
> Oh, and write unit-tests from the beginning!
I wonder if that is the best approach if one doesn't have much
experience with Python. I know that is the ideal thing to do, but it
you don't have much experience, you'll probably have to do it again
anyway. Perhaps do a few line-by-line (the ones you need right now if
you can keep it to a small subset), and after you get some experience
writing (and reading other people's) Python code, redo them.
Just a thought.
Another thought: avoid the "common block" approach as much as you can
in your new code. There are usually better ways to do it.
More information about the SciPy-User