[SciPy-Dev] fwrap refactor: What about complex -> real?

Dag Sverre Seljebotn dagss@student.matnat.uio...
Thu Dec 9 13:11:56 CST 2010


When faced with Fortran functions expecting a real scalar, f2py will 
happily accept complex numbers and silently discard the imaginary part.

Is this really the preferred behaviour? It would take quite a bit of 
work to have fwrap behave like that, and I've heard occasional 
complaints about the behaviour earlier (can't say I'm fond of it myself 
either).

Opinions?

(Note that Python implements ".real" on float objects, so the fix is in 
all cases trivial when this breaks things for people, one just appends 
".real" when calling the function, which should also increase the 
readability of the code.)

Dag Sverre


More information about the SciPy-Dev mailing list