[PEAK] issues while porting priority_methods to use peak.rules.predicates.priority

Christoph Zwerschke cito at online.de
Tue Aug 17 18:58:43 EDT 2010


Am 17.08.2010 23:21 schrieb Alberto Valverde:
> Is there any way to tell peak.rules to consider that a "priority" is
> always implied by any other criterion so the fact that it is present
> in a predicate doesn't raise the predicate's selectiveness? (does
> that make sense?)

Strangely, even when I add priorities everywhere, I still get the 
AmbiguousMethods error, is this a bug?

from peak.rules import value
from peak.rules.predicates import priority

f = lambda n, m: 0
f1, f2, f3 = value(1), value(2), value(3)

when(f, "n==5")(f1)
when(f, "m==5")(f2)
when(f, "n==5 and m==5")(f3)

print f(5,5) # works, returns 3

when(f, "n==5 and priority(1)")(f1)
when(f, "m==5 and priority(1)")(f2)
when(f, "n==5 and m==5 and priority(1)")(f3)

print f(5,5) # ambiguous

-- Christoph


More information about the PEAK mailing list