[Python-3000] Adaptation vs. Generic Functions

Ian Bicking ianb at colorstudy.com
Wed Apr 5 23:07:31 CEST 2006


Walter Dörwald wrote:
> Guido van Rossum wrote:
> 
> 
>>Fascinating ideas in this thread!
>>
>>I spent some time blogging about this on artima:
>>http://www.artima.com/weblogs/viewpost.jsp?thread=155123
>>
>>I have to write my slides for a talk about Py3K later today, but I'll
>>be back. In the mean time I've rejected PEPs 245 and 246 in
>>expectation of something better that's imminent!
> 
> 
> What's still missing IMHO is a way for an adapter to defer to the next 
> adapter in the chain, i.e. something like:

Sounds like next_method in generic functions, which is an area of 
generic functions we haven't touched upon (but which seem important).  I 
think in RuleDispatch it goes like:

   @foo.when(...)
   def incremented_foo(next_method, arg1, arg2):
       return next_method(arg1, arg2) + 1

By using a first argument named "next_method" you tell the generic 
function machinery to pass in this special object, which acts like the 
original generic function ("foo" in this case) but ignores the current 
method.

I assume there won't be very positive reaction here to behavior based on 
an argument name.  But ignoring that aspect, it's a somewhat important 
feature of typical generic function implementations, and very similar to 
super.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Python-3000 mailing list