Mercurial > pytave
changeset 208:3edceb6b7504
add "help" command to access python docstrings
* @pyobj/pyobj.m: add "help" method
author | Colin Macdonald <cbm@m.fsf.org> |
---|---|
date | Thu, 26 May 2016 12:43:56 -0700 |
parents | 4a369c94cab8 |
children | a54ab59c491d |
files | @pyobj/pyobj.m |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/@pyobj/pyobj.m Fri May 20 23:18:46 2016 -0700 +++ b/@pyobj/pyobj.m Thu May 26 12:43:56 2016 -0700 @@ -131,5 +131,15 @@ r = pyeval (sprintf ('__InOct__["%s"]%s', x.id, s)); end + function vargout = help(x) + idx = struct('type', '.', 'subs', '__doc__'); + s = subsref(x, idx); + if (nargout == 0) + disp(s) + else + vargout = {s}; + end + end + end end