__init__ question

David Porter jcm at bigskytel.com
Mon Dec 25 14:47:08 EST 2000


* Daniel Klein <DanielK at aracnet.com>:

>     def __init__(self, *args):
> 
> What is the meaning of the '*args' expression?

It gathers the remaining non-keyword args into a tuple called args. Another
form is **args which gathers the remaining keyword args into a dict. These
is useful when you require an arbitrary number of arguments passed to a
function.

Note that the order must be func(normal_args, *args, **kwargs).


David




More information about the Python-list mailing list