[SciPy-user] [f2py] hide ?

Robert Kern robert.kern at gmail.com
Wed Apr 25 18:05:40 EDT 2007


fred wrote:
> Hi,
> 
> I read the PerfomancePython doc, and specially, the example using f2py.
> 
> I try to getting work my own example but I can't :-(
> 
> Here the short fortran code:
> 
>       subroutine essai(n)
>      
> cf2py integer intent(hide) :: n
>      
>       integer :: n
>      
>       print *, 'n = ', n
>      
>       end subroutine
> 
> After compiling it, I try this:
> 
> Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.7.2 -- An enhanced Interactive Python.
> ?       -> Introduction to IPython's features.
> %magic  -> Information about IPython's 'magic' % functions.
> help    -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
> 
> In [1]: n=13
> 
> In [2]: import essai; essai.essai()
>  n =  0
> 
> In [3]:
> 
> What am I doing wrong ?

Variables "just sitting there" won't have any effect whatsoever inside the
FORTRAN subroutine. You would have to pass it in as an argument to essai(); it
can't be hidden. intent(hide) is for situations where you can derive the value
from other inputs, like the length of an array.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list