[PEAK] Re: ruledispatch

Phillip J. Eby pje at telecommunity.com
Wed Mar 15 11:41:18 EST 2006


At 04:00 PM 3/15/2006 +0100, Elvelind Grandin wrote:
>Ah. Thanks. I've frankly have had some problems finding the online docs.

That's because there aren't any, besides that page, and my article on 
implementing the Visitor pattern with generic functions (I think it's 
VisitorRevisited in the wiki).


>What is the prefered way to have a fallback method? .when('True') or 
>something?

from dispatch import strategy

@whatever.when(strategy.default)


>On 3/15/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 12:19 PM 3/15/2006 +0100, Elvelind Grandin wrote:
> > >Hi again.
> > >
> > >One followup question.
> > >When two rules applies equally there is an exception raised. Is it
> > >possible to tell it to use the first of those two rules instead. So
> > >that it always falls back to some function.
> >
> > Yes, by using a custom method combination.  See:
> >
> > http://peak.telecommunity.com/DevCenter/CombiningResults
> >
> > or 'combiners.txt' inside the dispatch package source.
> >
> >




More information about the PEAK mailing list