diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2007-07-27 13:57:12 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2007-07-27 13:57:12 +0000 |
commit | e4ccde2aa3ee6b6edb5b22ad5c0dcda430dac8e1 (patch) | |
tree | 507ad7255392ca0c2c2d2673e03d025cf6e4c761 /numpy/f2py | |
parent | 0b607334bef559e3c822974e4145f3fd0865e687 (diff) | |
download | numpy-e4ccde2aa3ee6b6edb5b22ad5c0dcda430dac8e1.tar.gz |
Doc update.
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/lib/doc.txt | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/numpy/f2py/lib/doc.txt b/numpy/f2py/lib/doc.txt index 45f149bf7..13accc371 100644 --- a/numpy/f2py/lib/doc.txt +++ b/numpy/f2py/lib/doc.txt @@ -17,7 +17,7 @@ The G3 F2PY library package contains tools to parse Fortran codes and construct Python C/API extension modules for wrapping Fortran programs. These tools are also suitable for implementing Fortran program translators or wrappers to any other programming language. In -fact, wrapping Fortran programs to Python would be one example of +fact, wrapping Fortran programs to Python would be just one example of using these tools. Wrapping Fortran with Python @@ -48,6 +48,19 @@ Python: - `--2d-numarray` --- create extension modules with Numarray array support using the old version of f2py2e. + Example:: + + $ cat hello.f90 + subroutine hello + print*, "Hello!" + end subroutine hello + $ f2py --g3-numpy -m foo -c hello.f90 --fcompiler=gnu95 + $ python + >>> import foo + >>> foo.hello() + Hello! + >>> + See the output of `f2py` for more information. __ http://projects.scipy.org/scipy/numpy/wiki/G3F2PY/ @@ -58,3 +71,16 @@ __ http://cens.ioc.ee/projects/f2py2e/ Fortran code and returns a list of imported extension modules that can be used to call Fortran programs from Python. + Example:: + + $ python + >>> from numpy.f2py.lib.api import compile + >>> code = 'subroutine hello\n print*, "Hello!"\nend' + >>> print code + subroutine hello + print*, "Hello!" + end + >>> foo, = compile(code, extra_args = ['--fcompiler=gnu95']) + >>> foo.hello() + Hello! + >>> |