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 terry.reedy
Recipients cool-RR, terry.reedy, yselivanov
Date 2014-10-03.20:56:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412369775.17.0.732677033754.issue22547@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-10-03 20:56:15terry.reedysetrecipients: + terry.reedy, cool-RR, yselivanov
2014-10-03 20:56:15terry.reedysetmessageid: <1412369775.17.0.732677033754.issue22547@psf.upfronthosting.co.za>
2014-10-03 20:56:15terry.reedylinkissue22547 messages
2014-10-03 20:56:14terry.reedycreate