[SciPy-dev] Documenting function-like classes

David Goldsmith d.l.goldsmith@gmail....
Sun Oct 25 21:03:34 CDT 2009


Duh, that's what the __call__ method supplies, isn't it.  Sorry for being
dense. :-(

DG

On Sun, Oct 25, 2009 at 6:58 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Sun, Oct 25, 2009 at 20:57, David Goldsmith <d.l.goldsmith@gmail.com>
> wrote:
> > 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?
>
> No. You call the instance that is created by the constructor, not the
> class.
>
> --
> 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
> 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/5a3a7b36/attachment-0001.html 


More information about the Scipy-dev mailing list