changeset 160:eab5c6026303

Add some examples to the documentation These are testable with the doctest pkg. py.cc: add documentation
author Colin Macdonald <cbm@m.fsf.org>
date Wed, 09 Mar 2016 14:15:26 -0800
parents a323f9fae46b
children dfea7eee7749
files py.cc
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/py.cc	Tue Apr 05 21:00:58 2016 -0700
+++ b/py.cc	Wed Mar 09 14:15:26 2016 -0800
@@ -38,8 +38,28 @@
 
 DEFUN_DLD (py, args, nargout,
            "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} py (@var{func})\n\
-@enddeftypefn")
+@deftypefn  {Loadable Function} py (@var{func})\n\
+@deftypefnx {Loadable Function} {@var{x} =} py (@var{func})\n\
+@deftypefnx {Loadable Function} {@var{x} =} py (@var{func}, @var{arg1}, @var{arg2}, @dots{})\n\
+Execute method of a Python module.\n\
+\n\
+Examples:\n\
+@example\n\
+@group\n\
+y = py('__builtin__.int(6)')\n\
+  @result{} y =  6\n\
+py('sys.version')\n\
+  @result{} ans = ...\n\
+py('__builtin__.eval(\"4+5\")')\n\
+  @result{} ans =  9\n\
+py('__builtin__.dict(one=1,two=2)')\n\
+  @result{} ans =\n\
+    scalar structure containing the fields:\n\
+      two =  2\n\
+      one =  1\n\
+@end group\n\
+@end example\n\
+@end deftypefn")
 {
   octave_value_list retval;