[PEAK] dispatch -- more specific
Simon Belak
simon.belak at hruska.si
Tue Dec 13 15:27:38 EST 2005
Phillip J. Eby wrote:
> You can easily make this so by using a rule like "isinstance(a,int) and
> a==3", which will then be more specific than "isinstance(a,int)".
>
> That is, to force one condition to more specific than another, you need
> only explicitly "and" the less specific condition with the more specific
> one. This forces it to be more specific by construction, even if
> RuleDispatch could not otherwise infer the implication.
>
>
This is how I am doing it now, but it feels a bit messy (or probably
dispatch as a whole has just spoiled me ;))).
On a related note, can specialisation of a generic function be a generic
function. For instance:
@foo.when(some_condition)
@generic.on(my_arg)
def bar(my_arg):
...
If so, how do I access it's methods (when())?
Thanks,
Simon
More information about the PEAK
mailing list