[Numpy-discussion] f2py pass by reference
sameer.grover.1 at gmail.com
Tue Apr 12 14:41:09 EDT 2011
On 12/04/11 23:36, Mathew Yeates wrote:
> I have
> subroutine foo (a)
> integer a
> print*, "Hello from Fortran!"
> print*, "a=",a
> and from python I want to do
> and I want a's value to now be 2.
> How do I do this?
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
Someone can correct me if I'm wrong but I don't think this is possible
with integers because they are treated as immuatable types in python.
You can, however, do this with numpy arrays with "intent(inplace)". For
write(*,*) "Hello from Fortran!"
end subroutine foo
a = np.array([1,2])
#a is now [2,2]
More information about the NumPy-Discussion