This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gsakkis
Recipients gsakkis
Date 2008-06-18.22:16:50
SpamBayes Score 0.0252446
Marked as misclassified No
Message-id <>
I'd like to propose a new function for inclusion to the inspect module
-- getcallargs(func, *args, **kwds) -- that returns a dict which maps
the formal arguments of a function (or other callable) to the values
passed as args and kwds, just as Python has to do when calling
func(*args, **kwds). For example:

>>> def func(a, b='foo', c=None, *x, **y):
...         pass
>>> sorted(getcallargs(func, 5, z=3, b=2).items())
 [('a', 5), ('b', 2), ('c', None), ('x', ()), ('y', {'z': 3})]

This is handy when writing decorators, or more generally when one would
want to do some minimal type checking without actually calling the function.

I have posted a recipe at; I can
clean it up and submit a proper patch if it's deemed useful enough for
the stdlib.
Date User Action Args
2008-06-18 22:16:54gsakkissetspambayes_score: 0.0252446 -> 0.0252446
recipients: + gsakkis
2008-06-18 22:16:54gsakkissetspambayes_score: 0.0252446 -> 0.0252446
messageid: <>
2008-06-18 22:16:52gsakkislinkissue3135 messages
2008-06-18 22:16:51gsakkiscreate