[SciPy-User] Porting code from IDL to Python - 'Common block' equivalent?

Dag Sverre Seljebotn dagss@student.matnat.uio...
Fri Jul 23 14:09:28 CDT 2010


On 07/23/2010 06: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 structure
> 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!
>    

If pyIDL lives up to what it says, I'd resist the temptation to rewrite 
*anything* up front, just write new stuff in Python, and occasionally 
call routines in IDL. Then bring over piece by piece when it feels 
natural (and one knows what is "wrong" by keeping it in IDL and how it 
would be better in Python); always making sure the whole thing works as 
before.

(I never used pyIDL, but I feel it should be something to investigate.)

http://www.cacr.caltech.edu/~mmckerns/software.html

Dag Sverre



More information about the SciPy-User mailing list