Python functions (and methods) can be called with any number (0 or more) parameters, but the calling sequence must match the 'template' or 'function prototype' given when defining the function. Let's define a function:

def fred(a,b,c=3,d=4,e=5,f=6):
print a,b,c,d,e,f

That function can be called with a minimum of two parameters, and a maximum of six. The mandatory ones are filled into variables called "a" and "b" and any others into "c", "d", "e" and "f". If there aren't enough values, then "f" will become 6, "e" will become 5, "d" will become 4 and "c" will become 3. In other words, values fill in from the beginning.

If you want to fill in some of the optional values, but not from the 'left', you can do so by specifying the name of the variable within the function and its value:

This is a page archived from The Horse's Mouth at
http://www.wellho.net/horse/ -
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.