[Numpy-discussion] docstring suggestions

Pierre GM pgmdevlist@gmail....
Sun Feb 14 00:52:01 CST 2010


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 ;)



More information about the NumPy-Discussion mailing list