brasse wrote:

Is there any way that I can get at all the arguments passed to a
function as a map without using keyword arguments?

def foo(a, b, c):
    # Can I access all the arguments in a collection somewhere?

I'm mainly curious since I have stumbled on to some cases where it
might have been nice to be able to do that.

Look up the function call syntaxes with * and **:

>>> def foo(*args): print args
...
>>> def bar(**keywords): print keywords
...
>>> foo(1, 2, 3)
(1, 2, 3)
>>> bar(a=1, b=2, c=3)
{'a': 1, 'c': 3, 'b': 2}

--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
 San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
  Custom reconciles us to everything.
   -- Edmund Burke
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to