Single and double asterisks preceding variables in function arguments

Aahz aahz at pythoncraft.com
Tue Jan 27 01:11:20 EST 2004


In article <bv3gdg$ms0sn$1 at ID-217427.news.uni-berlin.de>,
anton muhin  <antonmuhin at rambler.ru> wrote:
>
>See item 7.5 in Language Reference. In short: * declaries list of 
>additional parameters, while ** declares map of additional parameters. 

Actually, ``*`` forces creation of a tuple:

>>> def foo(*bar):
...   print type(bar)
...
>>> l = [1,2,3]
>>> foo(*l)
<type 'tuple'>
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR



More information about the Python-list mailing list