I know this is dummy, just never saw an example of this.

I want to use the special argument matching.

A code like this:

def adder(**varargs):
      sum=varargs[varargs.keys()[0]]
      for next in varargs.keys()[1:]:
                sum=sum+varargs[next]
      return sum

print adder( "first","second",'third')


------------------------
It pop up error like this:

Traceback (most recent call last):
  File "learn.py", line 7, in ?
    print adder( "first","second",'third')
TypeError: adder() takes exactly 0 arguments (3 given)


How to pass arguments to a functions that use dictionary collection?


Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to