[SciPy-dev] Documenting function-like classes

David Goldsmith d.l.goldsmith@gmail....
Sun Oct 25 20:57:22 CDT 2009


And a follow up...

On Sun, Oct 25, 2009 at 6:42 PM, Anne Archibald
<peridot.faceted@gmail.com>wrote:

> Generally, I use one when an object I am representing with a class has
> a natural evaluation map. So, for example, an object representing a
> polynomial ought to be a class - you can multiply it, you can compute
> derivatives and antiderivatives, you can look at its coefficients -
> but you should also be able to use it like a function, to evaluate at
> a particular place.
>

However, since the syntax myClass() is already "spoken for" by the c-tor,
for the function-like behavior don't you still have to: A) define a method
attribute, and B) call it using '.' resolution syntax?

DG

When documenting such a thing, it seems to me you should treat
> __call__ like __init__ or any other method whose name is a bit
> obscure. Which, as I understand it, means that the class docstring
> should mention the existence of them but the bulk of the documentation
> should be in the method docstring.
>
> Anne
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20091025/a6485396/attachment.html 


More information about the Scipy-dev mailing list