*args and **kwargs
Erik Max Francis
max at alcyone.com
Tue Nov 26 20:26:24 EST 2002
Andrew Lusk wrote:
> So you can send in keyval pairs and it will get a dictionary. Useful
> for having multiple unordered optional arguments.
Concisely stated. Note that you can also (Python 2.x) use the * and **
syntaxes for _calling_ functions. As a shortcut to the apply builtin,
you can call a function using the *args and **keywords syntax:
f(*args)
g(**keywords)
h(*args, **keywords)
etc.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Everyone wants to look good at his own funeral.
\__/ Louis Wu
PyUID / http://www.alcyone.com/pyos/uid/
A module for generating "unique" IDs in Python.
More information about the Python-list
mailing list