[PEAK] dispatch questions

Dave Peticolas dave at krondo.com
Mon Mar 14 21:34:28 EST 2005


I have a question about the dispatch module. Attached is a test file
with two classes that use dispatch from a fairly recent but not 
completely up-to-date cvs checkout. I would have expected the output
from both classes to be this:

before == 5 a    (1st before method)
before == 5 b    (2nd before method
when five        (when method)

But when the default case is specified as when('x != 5'), as opposed
to when(dispatch.strategy.default), the order of the before methods
changes:

before == 5 b
before == 5 a
when five

I realize that when('x != 5') would be a lousy way of specifying the
default case, but I don't understand why the two outputs would differ
for the non-default case (x == 5). Also, it now seems that the order
doesn't change when I use the latest checkout of PEAK. Is this a bug 
that has been fixed or is the order of those two 'before' methods 
undefined?

Also, I would have expected when('True') to behave like
when(dispatch.strategy.default), but it seems to have the
same 'specificity' as, say, 'x == 5'. Is that the correct
behavior?

thanks,
dave

ps dispatch is cool

-------------- next part --------------
A non-text attachment was scrubbed...
Name: d.py
Type: application/x-python
Size: 818 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20050314/853610a8/d.bin


More information about the PEAK mailing list