[Tutor] Re: calling a function with a variable number of arguments
Andrei
project5 at redrival.net
Wed Nov 12 08:11:50 EST 2003
Eur van Andel wrote on Wed, 12 Nov 2003 12:32:06 +0100:
> Hi
>
> Am I correct in assuming that a function:
>
> def funct_1(a0, a1=1, a2=2)
>
> can be called with either 1, 2 or 3 arguments?
Yep.
> And if I call it:
>
> funct_1(4, 4)
>
> a2 will stay 2?
Yep.
> And so to modify the default value for a2, three arguments are needed?
Nope. If you use arguments with default values, you can do this:
funct_1(45, a2=30)
a1 will then keep its default value.
> Where can I find this in the manual?
Paragraphs 4.6 and 4.7 of the tutorial.
--
Yours,
Andrei
=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.
More information about the Tutor
mailing list