[Numpy-discussion] docstring suggestions

David Goldsmith d.l.goldsmith@gmail....
Sun Feb 14 01:19:44 CST 2010


On Sat, Feb 13, 2010 at 10:52 PM, Pierre GM <pgmdevlist@gmail.com> wrote:

> On Feb 14, 2010, at 1:42 AM, David Goldsmith wrote:
> >
> > On Sat, Feb 13, 2010 at 9:53 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
> > On Feb 13, 2010, at 11:56 PM, David Goldsmith wrote:
> > >
> > >
> > > Please don't misinterpret my statements to mean that I think this isn't
> important and/or that you should feel solely responsible for a fix - I
> sincerely just wanted to uncover the nature and extent of the problem.
>  Unfortunately, I still feel like I don't really understand the functional
> origin of the problem, otherwise I'd be the first to be offering to help -
> perhaps if you can explain to me what you think is happening...
> >
> > In a nutshell:
> > some functions in numpy.ma (like np.ma.compress) are actually instances
> of a factory class (_frommethod). This class implements a __call__ method,
> so its instances behave like functions. In practice, they just call a method
> of MaskedArray. Anyway, the __doc__ of the instance is created from the
> docstring of the corresponding method with _frommethod.getdoc. I'm sure
> that's where we can improve things (like substistute `self `by `a`.
> > Because it's an instance, help(numpy.ma.compress) gives the docstring of
> numpy.ma._frommethod instead. In IPython, numpy.ma.compress? gives you the
> doc, twice (I don't get why).
> >
> > Excellent, thanks Pierre: w/ this in the thread, if I can't help (I'm no
> expert on factory classes, nor, certainly, on the why's and wherefore's of
> iPython) I'm all but certain we have the communal know-how to get this taken
> care of quickly.  One final request, though, if I may: perhaps you could
> make the issue "official" by filing a ticket?  Thanks again!
>
> Well, you're the one who started the conversation, so *you* should open the
> ticket ;)
>

Actually, it was Hans Meine, but no matter, I'll file "the __doc__ of the
instance is created from the docstring of the corresponding method with
_frommethod.getdoc. I'm sure that's where we can improve things (like
substistute `self `by `a`" and the "Because it's an instance,
help(numpy.ma.compress) gives the docstring of numpy.ma._frommethod instead"
as numpy tickets (I just thought you might be able to describe the problems
better, and, due to a deeper understanding, be a better point of contact for
the tickets - all I'll do is quote your above characterizations).

Thanks, Fernando, for filing the iPython issue.

DG


Thanks, Fernando
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100213/6e00065a/attachment.html 


More information about the NumPy-Discussion mailing list