Issue 22547: Implement informative __repr__ for inspect.BoundArguments

This commit is contained in:
Yury Selivanov 2015-05-14 18:47:17 -04:00
parent 6b4046f062
commit 3f6538fed0
3 changed files with 17 additions and 0 deletions

View file

@ -2460,6 +2460,13 @@ class BoundArguments:
def __getstate__(self):
return {'_signature': self._signature, 'arguments': self.arguments}
def __repr__(self):
args = []
for arg, value in self.arguments.items():
args.append('{}={!r}'.format(arg, value))
return '<{} at {:#x} ({})>'.format(self.__class__.__name__,
id(self), ', '.join(args))
class Signature:
"""A Signature object represents the overall signature of a function.