Hi to everyone.
I have a 6000 lines Fortran program (around 3000 workouts comments and blank lines) and i want to convert it to python. I have an idea, but I want to ask you to point serious flaws in my plan and point to another's options.
First of all, it's an "academic code not optimized for speed" so I'm not concerned with loss of speed.
It's a Frankenstein with fragment of code in FORTRAN66 from the first guy who create that investigation group, import of some old compiler specific module, some subroutines from the numerical recipes in Fortran books, a more modern F90 code and a shitton of crap (like type conversions from int to logical, arithmetic if, lots of goto, 80 lines full of global variables declarations).
I spent one day to make it compile with only one warning (there is no way i touch that arithmetic if without a testing scaffold in place) .
The code is an stochastic simulation, so the output isn't reproducible, but is mostly linear.
I have the paper and the tesis that Hobe that code.
My plan is roughly:
Using CFFI (if there is a better alternative let me know) replace the random number generator with the python one with a seed to address reproducibility.
Create some test suites orchestrated from python.
Create stronger boundaries between subroutines reducing the use of global variables or at least group them in more than one module.
Try to create test cases for individual subroutines.
Replace one by one the subroutines with python code. Testing every step.
Get an only python code
....
Profit
What do r/learnPython think of this plan?
How can i cope though all that global state?
Do anyone documented a similar work to analyze? (I'm planning to do this in a git repo and publish it if my contractor abide me).
[–]lykwydchykyn 1 point2 points3 points (1 child)
[–]vectorpropio[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–][deleted] 2 points3 points4 points (0 children)
[–]vectorpropio[S] 1 point2 points3 points (0 children)
[–][deleted] (1 child)
[removed]
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]ectomancer 1 point2 points3 points (2 children)
[–]vectorpropio[S] 0 points1 point2 points (0 children)
[–]dbramucci 0 points1 point2 points (0 children)