[SciPy-dev] Documenting function-like classes
Sun Oct 25 20:57:22 CDT 2009
And a follow up...
On Sun, Oct 25, 2009 at 6:42 PM, Anne Archibald
> 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?
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.
> Scipy-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scipy-dev