Gerhard Fiedler schrieb: > On 2006-07-24 14:30:31, Brian Beck wrote: > >> Michael Yanowitz wrote: >>> Maybe I am missing something, but from what I've seen, >>> it is not possible to overload functions in Python. That >>> is I can't have a >>> def func1 (int1, string1): >>> and a >>> def func1 (int1, int3, string1, string2): >>> without the second func1 overwriting the first. >> Correct. > > Can you write a function that accepts any number of arguments? And then > branch based on the number of arguments supplied? > > I guess you can do that with a list as only argument. But can that be done > using the "normal" function argument notation?
I guess you mean something like func1(int1, arg2, *args): if len(args) == 2: ... elif not args: ... else: raise ... Stefan -- http://mail.python.org/mailman/listinfo/python-list