callable classes
Michael Hudson
mwh at python.net
Fri Dec 26 14:12:25 EST 2003
"Duncan Smith" <buzzard at urubu.freeserve.co.uk> writes:
> 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?
It's hard (for me at least) to see what you mean. Post some code?
> In what circumstances are callable classes particularly useful?
Well, I guess you could say when you have a callable with state. I
must admit I prefer to use a bound method in these circumstances, but
I'm not really sure why.
Cheers,
mwh
--
Exam invigilation - it doesn't come much harder than that, esp if
the book you're reading turns out to be worse than expected.
-- Dirk Bruere, sci.physics.research
More information about the Python-list
mailing list