[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get docstring of a function ?
From: |
Søren Hauberg |
Subject: |
Re: How to get docstring of a function ? |
Date: |
Tue, 11 May 2010 21:32:02 -0700 |
tir, 11 05 2010 kl. 14:26 -0500, skrev Jordi Gutiérrez Hermoso:
> 2010/5/11 Søren Hauberg <address@hidden>:
>
> > Looking at your patch (I haven't tried it), I get the impression that
> >
> > a = help ("some_function");
> >
> > will return the docstring, but also display it.
>
> No, did you see the context? printf is actually used for displaying
> the docstring.
I'm confused now. I see the following in your patch
@@ -79,6 +79,10 @@
which (name);
printf ("\n%s\n%s", text, __additional_help_message__ ());
+ if(nargout == 1)
+ docstring = text;
+ endif;
Doesn't that mean that
printf ("\n%s\n%s", text, __additional_help_message__ ());
will be evaluated independently of the value of 'nargout'? This, in
turn, means that the help text will be displayed when the user requests
an output argument. Is this not true?
Shouldn't the code rather be
if (nargout == 0)
which (name);
printf ("\n%s\n%s", text, __additional_help_message__ ());
else
docstring = text;
endif
such that the help text is only displayed when the user is not
requesting any output arguments?
Søren
- How to get docstring of a function ?, Pablo Winant, 2010/05/10
- Re: How to get docstring of a function ?, Jordi Gutiérrez Hermoso, 2010/05/11
- Re: How to get docstring of a function ?, Ben Abbott, 2010/05/11
- Re: How to get docstring of a function ?, Jordi Gutiérrez Hermoso, 2010/05/11
- Re: How to get docstring of a function ?, Søren Hauberg, 2010/05/11
- Re: How to get docstring of a function ?, Jordi Gutiérrez Hermoso, 2010/05/11
- Re: How to get docstring of a function ?,
Søren Hauberg <=
- Re: How to get docstring of a function ?, Jordi Gutiérrez Hermoso, 2010/05/12
- Re: How to get docstring of a function ?, Ben Abbott, 2010/05/12
- Re: How to get docstring of a function ?, Søren Hauberg, 2010/05/12
- Re: How to get docstring of a function ?, Ben Abbott, 2010/05/12
- Re: How to get docstring of a function ?, John W. Eaton, 2010/05/13
- Re: How to get docstring of a function ?, Ben Abbott, 2010/05/12