Terry J. Reedy added the comment:

Context: inspect.signature returns an inspect.Signature instance. Its .bind and 
.bind_partial methods return ab inspect.BoundArguments instance with a standard 
<...@ 0x...> representation.

>>> import inspect
>>> def foo(a, b=10): pass

>>> ba = inspect.signature(foo).bind(5)
>>> ba
<inspect.BoundArguments object at 0x0000000002C94080>

BAs already have 3 data access methods
>>> ba.arguments  # I believe this describes the object pretty fully
OrderedDict([('a', 5)])
>>> ba.args
(5,)
>>> ba.kwargs
{}

A possible proposal for this case would be <BoundArguments: a=5>.  However, 
this contains the same info as ba.arguments but in a less accessible form.

Listing all parameters (and their default values if any) would be wrong as the 
additional info is not part of the object.  The doc says to use 
Signature.parameters for full info, and it shows how to do that.  So I am 
negative on the proposal.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to