[Python-Dev] Updated PEP 362 (Function Signature Object) (original) (raw)

Daniel Urban urban.dani+py at gmail.com
Wed Jun 6 19:39:28 CEST 2012


BoundArguments Object =====================

Result of a Signature.bind call.  Holds the mapping of arguments to the function's parameters.

The Signature.bind function has changed since the previous version of the PEP. If I understand correctly, the 'arguments' attribute is the same as the return value of bind in the previous version (more or less the same as the return value of inspect.getcallargs). My question is: why we need the other 2 attributes ('args' and 'kwargs')? The "Annotation Checker" example uses it to call the function. But if we are able to call bind, we already have the arguments, so we can simply call the function with them, we don't really need these attributes. I think it would be better (easier to use and understand), if bind would simply return the mapping, as in the previous version of the PEP.

Has the following public attributes:

* arguments : OrderedDict An ordered mutable mapping of parameters' names to arguments' values. Does not contain arguments' default values.

Does this mean, that if the arguments passed to bind doesn't contain a value for an argument that has a default value, then the returned mapping won't contain that argument? If so, why not? inspect.getcallargs works fine with default values.

Daniel



More information about the Python-Dev mailing list