[PEAK] Re: ruledispatch
Phillip J. Eby
pje at telecommunity.com
Thu Mar 16 15:48:37 EST 2006
At 08:24 PM 3/16/2006 +0100, Elvelind Grandin wrote:
>On 3/16/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 09:30 AM 3/16/2006 +0100, Elvelind Grandin wrote:
> > >Okay. so from what I understand method_chain look like the thing I want to
> > >use.
> >
> > Probably 'method_chain(all_methods(grouped_cases))' is what you want.
> >
> >
> > >But I'm still confused on how to use it.
> > >Do I need to create my own Class that extends something and pass i to
> > >dispatch.generic() ?
> >
> > Yes.
>
>So that Class would look something like?
>class Pricing(functions.AbstractGeneric):
> def combine(self,cases):
> ???
I think you want functions.GenericFunction, so you get all the default
'when', 'around', etc. methods. I don't think those are available on
AbstractGeneric, so you'd have to duplicate them. I suggest you copy the
standard combine() method and then edit it.
More information about the PEAK
mailing list