summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:41:53 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:41:53 (GMT)
commit374375dd26118ccb7027f66d66ab9e80c82f4103 (patch)
tree29229a2cf3e02c4f7282246dfded9deb5420ce7b /Lib/inspect.py
parent722e2489bbf581f0d839192512829af1a0cfe7cd (diff)
downloadcpython-374375dd26118ccb7027f66d66ab9e80c82f4103.zip
cpython-374375dd26118ccb7027f66d66ab9e80c82f4103.tar.gz
cpython-374375dd26118ccb7027f66d66ab9e80c82f4103.tar.bz2
inspect.signature: Improve repr of Signature and Parameter. Closes #20378
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index acb8071..05d67fc 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2192,8 +2192,8 @@ class Parameter:
return formatted
def __repr__(self):
- return '<{} at {:#x} {!r}>'.format(self.__class__.__name__,
- id(self), self.name)
+ return '<{} at {:#x} "{}">'.format(self.__class__.__name__,
+ id(self), self)
def __eq__(self, other):
# NB: We deliberately do not compare '_partial_kwarg' attributes
@@ -2698,6 +2698,10 @@ class Signature:
def __setstate__(self, state):
self._return_annotation = state['_return_annotation']
+ def __repr__(self):
+ return '<{} at {:#x} "{}">'.format(self.__class__.__name__,
+ id(self), self)
+
def __str__(self):
result = []
render_pos_only_separator = False