[Python-ideas] Add PassedArgSpec class to types and expose mapping given an ArgSpec.
ncoghlan at gmail.com
Thu Sep 19 02:23:09 CEST 2013
(Extra copy to the list, since Google Groups breaks the recipient list :P)
inspect.Signature.bind() supports this in Python 3.3+
For earlier versions, Aaron Iles backported the functionality on PyPI as
You can also just define an appropriate function, call it as f(*args,
**kwds) and return the resulting locals() namespace.
On 19 Sep 2013 04:39, "Neil Girdhar" <mistersheik at gmail.com> wrote:
> As far as I know, the way that arguments are mapped to a parameter
> specification is not exposed to the programmer. I suggest adding a
> PassedArgSpec class having two members: args and kwargs. Then,
> inspect.ArgSpec can take an argument specification and decode the
> PassedArgSpect (putting the right things in the right places) and return a
> dictionary with everything in its right place.
> I can only think of one use for now, which is replacing "arguments" in the
> returned tuple of __reduce__ and maybe allowing it to be returned by
> "__getnewargs__". It might also be nice to store such argument
> specifications instead of the pair args, kwargs when storing them in lists.
> Python-ideas mailing list
> Python-ideas at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas