newbie-question: overloading methods
Emile van Sebille
emile at fenx.com
Sat May 18 08:58:18 EDT 2002
"merman" <merman at freenet.de> wrote in message
news:3ce645b7$0$23712$9b622d9e at news.freenet.de...
> Hi,
>
> is there a way to overload methods like in C++ or Java?
>
Does this help?
>>> def test(arg1=None, arg2=None, arg3=None, *args, **kwargs):
... print arg1, arg2, arg3, args, kwargs
...
>>> test(1,2)
1 2 None () {}
>>> test(1,2,3,4)
1 2 3 (4,) {}
>>> test(1,2,3,4,5,helpmode=1)
1 2 3 (4, 5) {'helpmode': 1}
>>>
--
Emile van Sebille
emile at fenx.com
---------
More information about the Python-list
mailing list