Method Overloading

asiegel at eico.com asiegel at eico.com
Wed Aug 30 14:57:31 EDT 2000


>Python doesn't support method overloading like C++ or Java,
>but does offer keyword arguments -- which can often share
>similar goals as method overloading.

FWIW - 
A while back I "ported" one of the Sun utility libraries , javax.vecmath - 
which makes
extensive use of method overloading , to Python\Numeric.  

Though the details are not fresh to me now, it got done.  Mostly used *args and

tested
for various conditions . Needed to provide for the "unraveling" of *args to 
allow
for an arbitrary level of sub-classing.

The end result was a Python version of vecmath that handled any of the 
constructors
as per the vecmath javadocs.  

Since its all handled up front in the instance creation, I had guessed
there was no great performance cost.

So yes the effect of method overfloading is achievable.

And-I ain't -no-guru-of no-kind-erly yours






More information about the Python-list mailing list