simplebeginnerquestion(**args)

Brian optional
Sun Jul 25 08:47:46 EDT 1999


I'm trying to figure out how to use the (**args) thing. I can manage
to pass an arbitrary # of arguments to a function with (*stuff) as a
tuple, but if I use (**stuff)  to do it like this:

myfunc(**stuff):
 for i in stuff.keys():
  print i 

myfunc(1,2,3,4)

the interpreter raises an error saying it expected..0 arguments and
got..4	if I use (*stuff) (without .keys()...) it works. 
Shouldn't (**stuff) cause a dictionary filled with myfunc(stuff here)
to happen and the 'print i' print up the keys?
What I don't get is why does it expect..0 arguments?Why doesn't it
realize that there is a ** there?






More information about the Python-list mailing list