next up previous contents
Next: 10.5 Lambda And Functional Up: 10.4 Optional Function Arguments Previous: 10.4.1 Default Argument Values

10.4.2 Arbitrary Argument Lists

It is also possible to specify that a function can be called with an arbitrary number of arguments. These arguments will be wrapped up in a tuple. Before the variable number of arguments, zero or more normal arguments may occur, e.g.

        def fprintf(file, format, *args):
                file.write(format % args)

This feature may be combined with the previous, e.g.

        def but_is_it_useful(required, optional = None, *remains):
                print "I don't know"



guido@cnri.reston.va.us