[PEAK] Issues with peak.rules predicates

rdmurray at bitdance.com rdmurray at bitdance.com
Sat Feb 9 22:57:10 EST 2008


On Sat, 9 Feb 2008 at 18:22, Phillip J. Eby wrote:
> No.  It's probably a bug of some sort.  If you can reduce the problem to a 
> short example, I should be able to fix it pretty easily.

I think this should be short enough :)

Given:

     >>> from peak.rules import when
     >>> def foo(Y):
     ...     print "default"
     >>> @when(foo, "not Y")
     ... def footest(Y):
     ...     print "footest"

This fails:

     >>> foo(False)
     footest


> The indexing and tree-building framework in PEAK-Rules is flexible enough 
> that one could probably create a "pretty-printing" engine to dump out a 
> logical representation of the dispatch tree, or perhaps generate equivalent 
> Python source code that could then be stepped through.  Check out 
> Indexing.txt and Predicates.txt in the source, if you're curious.

I thought that might be the case.  If/when I next need it, I'll take
a look.

--David



More information about the PEAK mailing list