[SciPy-dev] Documenting function-like classes
Sun Oct 25 21:03:34 CDT 2009
Duh, that's what the __call__ method supplies, isn't it. Sorry for being
On Sun, Oct 25, 2009 at 6:58 PM, Robert Kern <firstname.lastname@example.org> wrote:
> On Sun, Oct 25, 2009 at 20:57, David Goldsmith <email@example.com>
> > And a follow up...
> > On Sun, Oct 25, 2009 at 6:42 PM, Anne Archibald <
> > 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
> > attribute, and B) call it using '.' resolution syntax?
> No. You call the instance that is created by the constructor, not the
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
> -- Umberto Eco
> Scipy-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scipy-dev