Get a list/tuple/dict of *all* the arguments passed to a function?
Posted
by Phillip Oldham
on Stack Overflow
See other posts from Stack Overflow
or by Phillip Oldham
Published on 2010-03-26T08:30:54Z
Indexed on
2010/03/26
8:33 UTC
Read the original article
Hit count: 170
Given the following function:
def foo(a, b, c):
pass
How would one obtain a list/tuple/dict/etc of the arguments passed in?
Specifically, I'm looking for Python's version of JavaScript's arguments
keyword or PHP's func_get_args()
method.
What I'm not looking for is a solution using *args
or **kwargs
; I need to specify the argument names in the function definition (to ensure they're being passed in) but within the function I want to work with them in a list- or dict-style structure.
© Stack Overflow or respective owner