[Python-ideas] Add PassedArgSpec class to types and expose mapping given an ArgSpec.

Nick Coghlan 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.
> Best,
> Neil
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130919/87dd47c3/attachment.html>

More information about the Python-ideas mailing list