callable classes

Duncan Smith buzzard at urubu.freeserve.co.uk
Sat Dec 27 14:01:03 EST 2003


"anton muhin" <antonmuhin at rambler.ru> wrote in message
news:bsi06a$d532h$1 at ID-217427.news.uni-berlin.de...
> Duncan Smith wrote:
> > I recently started to rewrite a class and decided to take a bunch of
related
> > methods and put them in a separate callable class.  (They're all what I
> > would call pointwise operations on pairs of instances, they raise
exceptions
> > for identical reasons, and they all return a new instance).  It seemed
like
> > a good idea at the time, but now I'm not so sure.  So my very general
> > questions are:
> >
> > Is this a reasonable use for a callable class?
> >
> > In what circumstances are callable classes particularly useful?  (Maybe
I
> > haven't racked my brains long enough.)
> >
> > Cheers.  TIA.
> >
> > Duncan
> >
>
> What do you mean by 'callable class'? Classes are callables. Ot you mean
>   a class that defines __call__ method? In this case it's really useful.
>
> regards,
> anton.

Yes, I meant a class that defines a __call__ method.  Cheers.

Duncan





More information about the Python-list mailing list