[Numpy-svn] r3905 - trunk/numpy/f2py/lib

numpy-svn@scip... numpy-svn@scip...
Fri Jul 27 08:57:18 CDT 2007


Author: pearu
Date: 2007-07-27 08:57:12 -0500 (Fri, 27 Jul 2007)
New Revision: 3905

Modified:
   trunk/numpy/f2py/lib/doc.txt
Log:
Doc update.

Modified: trunk/numpy/f2py/lib/doc.txt
===================================================================
--- trunk/numpy/f2py/lib/doc.txt	2007-07-27 12:33:50 UTC (rev 3904)
+++ trunk/numpy/f2py/lib/doc.txt	2007-07-27 13:57:12 UTC (rev 3905)
@@ -17,7 +17,7 @@
 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 @@
     - `--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 @@
     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!
+      >>>



More information about the Numpy-svn mailing list