View Single Post
  #3 (permalink)  
Old 08-14-2007, 05:46 AM
santoshmalvi santoshmalvi is offline
D-Web Trainee
 
Join Date: Mar 2007
Location: Bangalore
Posts: 11
santoshmalvi is on a distinguished road
Default Re: Does Python supports Function Overloading?

Bit explaination on python Function Overloading?

Java and Powerbuilder support function overloading by argument list, i.e. one class can have multiple methods with the same name but a different number of arguments, or arguments of different types. Other languages (most notably PL/SQL) even support function overloading by argument name; i.e. one class can have multiple methods with the
same name and the same number of arguments of the same type but different argument names.

Python supports neither of these; it has no form of function overloading whatsoever. Methods are defined solely by their name, and there can be only one method per class with a given name. So if a descendant class has an __init__ method, it always overrides the ancestor __init__ method, even if the descendant defines it with a different argument list.

And the same rule applies to any other method.

Thank you,
Santosh Malvi
Reply With Quote