Overloading __init__ & Function overloading

Fredrik Lundh fredrik at pythonware.com
Fri Sep 30 09:53:43 EDT 2005


"Iyer, Prasad C" wrote:

> a. Is there something like function overloading in python?

not in the usual sense, no.  function arguments are not typed, so there's nothing
to dispatch on.  there are several cute tricks you can use to add dispatching on
top of "raw" python, but that's nothing you should do unless you have very good
reasons.

> b. Can I overload __init__ method

not in the usual sense, no.  same reason as above.

also see:

http://www.python.org/doc/faq/programming.html#how-can-i-overload-constructors-or-methods-in-python

</F> 






More information about the Python-list mailing list