simplebeginnerquestion(**args)
Jeff Epler
jepler at inetnebr.com
Sun Jul 25 09:17:33 EDT 1999
Brian,
When you're going to use "named" arguments, such as
myfunc(a=1, b=2, c=3, d=4)
then it's appropriate to use
def myfunc(**kw): pass
but when you're using unnamed arguments, such as
myfunc(1, 2, 3, 4)
you want to use
def myfunc(*args): pass
This makes sense, because for unnamed arguments the position is important
but there's no sensible key to give them if they were placed in a
dictionary---so instead, you get them as a tuple with "*args". But if the
arguments are named, obviously they need to go into a dictionary.
Jeff
--
\/ http://www.infidels.org/ Jeff Epler jepler at inetnebr.com
"Pay no attention to the man behind the curtain."
-- Karl, as he stepped behind the computer to reboot it, during a FAT
More information about the Python-list
mailing list