[Python-3000] Kill "generic functions"!

Delaney, Timothy (Tim) tdelaney at avaya.com
Mon Apr 10 00:56:37 CEST 2006


Guido van Rossum wrote:

> What about overloaded functions, which is the term used in C++ and
> Java for a similar mechanism (that happens at compile-time -- but it's
> standard Python practice to move things to run-time). We could then
> also talk about overloaded methods when we're using the mechanism
> inside a class.

Haven't seen this in the thread yet (may have missed it).

There appear to be two features which these come close to - overloaded
functions, and template specialisations (C++).

Depending on which way you look at it, the feature could be either. If
the behaviour is remarkably different depending on what type of
parameters are passed, it's overloading. If the behaviour is supposed to
be basically the same, but perhaps more efficient with different types
of parameters, it's specialisation.

It seems more akin to C++ template specialisation to me - there is a
default implementation which is used if no more specialised method for
those parameter types is available.

So I'd suggest the term "function specialisation".

Tim Delaney


More information about the Python-3000 mailing list