[Python-3000] Kill "generic functions"!

Ian Bicking ianb at colorstudy.com
Sat Apr 8 00:55:04 CEST 2006


Terry Reedy wrote:
> "Michael Chermside" <mcherm at mcherm.com> wrote in message 
> news:20060407045305.twzae7mu83y804s8 at login.werra.lunarpages.com...
> 
>>Greg Ewing writes:
>>
>>>"Multiple dispatch"
>>
>>+1
>>
>>How is the noun spelled? "Multiple Dispatch Function"? Too wordy perhaps? 
>>I
>>like it anyhow.
> 
> 
> -1
> 
> To me, multiple dispatch mean dispatching on multiple arguments, whereas 
> the
> simple and most common of what we are talking about is, I believe,
> sinple arg dispatch to multiple implementations.

Drop the "multiple" part?  There's no other function that dispatches. 
Methods can be thought of as dispatching on their first argument... but 
even that's a stretch, and you'd only think about it that way coming 
from a static typed background, and maybe then only if you came to 
statically typed OO programming after doing non-OO programming for a 
while.

In Python methods are selected based on an object (and that happens on 
the callers side), and that object is also passed in as the first 
argument (which happens in the class machinery), and none of that is 
done by the function/method object itself.  So I think calling current 
method invocation a "dispatch" is not accurate, nor natural.  Though 
calling any current behavior overloading is not accurate or natural either.

But I don't know, if we're concerned about how people coming from Java 
or C++ might misunderstand this... well, I at least am not one of those 
people ;)  Overloaded doesn't bother me, though I still prefer 
dispatching functions and methods.

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


More information about the Python-3000 mailing list