Next / Previous / Contents / TCC Help System / NM Tech homepage

8.4. Extra positional arguments

You can declare your function in such a way that it will accept any number of positional parameters. To do this, use an argument of the form “*name” in your argument list.

Here is an example of such a function.

>>> def h(i, j=99, *extras):
...     print i, j, extras
... 
>>> h(0)
0 99 ()
>>> h(1,2)
1 2 ()
>>> h(3,4,5,6,7,8,9)
3 4 (5, 6, 7, 8, 9)
>>>