Does python support multi prototype.

Jorgen Grahn jgrahn-nntq at algonet.se
Wed Aug 4 09:13:18 EDT 2004


On Wed, 04 Aug 2004 02:17:11 GMT, Chris Dutton <rubyguru at hotmail.com> wrote:
> angel wrote:
>> Hi
>> 
>> Java and cpp support one function name multi function prototype.

To be pedantic, C++ is called "C++", not "cpp", and what you seem to refer
to is what C++ calls "overloaded function names" or "overloading".

...
>> Does python support it?
> 
> No, but it doesn't have to.  The type of a function's arguments are not 
> statically limited.
...

Yes, but that's not as elegant in cases where the arguments' types has to
trigger very different processing. I can even imagine situations where
foo(S) and a foo(T) do completely different things, and still 'foo' is the
best name for both of them.

I miss overloading in Python from time to time, but I can live without it.
It is, after all, closely tied to a type system which is desirable in C++
and Java, but not in Python.

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@      ''If All Men Were Brothers,
\X/                algonet.se>    Would You Let One Marry Your Sister?''



More information about the Python-list mailing list