Asterisk sign in python

John Roth newsgroups at jhrothjr.com
Thu Feb 26 14:50:24 CET 2004


"sarmin" <sarmin_kho at yahoo.com> wrote in message
news:mailman.159.1077796055.8594.python-list at python.org...
> Hi Pythoners...
>
> It seems to me the Asterisk (*) sign in python means many things...
>
> if a python code line looks like this:
> def__init__(self, func, *param):
>   bla bla bla...
>
> and then u have something like this:
> func(*param)
>
> and then something like this:
> def Wrapper(select, func, param):
>    bla bla bla...
>
> I took this section of code from the 'Python Cookbook' textbook page
> 223 about 'Running Functions in the future'...
>
> I just cant figure out what is the asterisk (*) sign for and what is
> the different between *param and param??
>
> Many thanks Pythoners...
>
> Regards
> sarmin

It's for variable length parameter lists. In a function
definition, one * is a list of additional positional
parameters, two **s is a dictionary of additional
keyword parameters.

In a function call, one * is a list of additional
positional parameters, two **s is a dictionary
of additional keyword parameters.

John Roth
>
>





More information about the Python-list mailing list