diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2017-11-16 03:30:59 +0900 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2017-11-15 13:30:59 -0500 |
commit | 762b9571c9c8c6b036f1bf90140a1d030b3f9a01 (patch) | |
tree | 8aacee139aaa773259cc43300b09e911038b7380 /Lib/inspect.py | |
parent | f8a4c03ede6048022f60a58d5a21b278b78a8a16 (diff) | |
download | cpython-git-762b9571c9c8c6b036f1bf90140a1d030b3f9a01.tar.gz |
bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 6d6fde9ee4..69f2b6209f 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2521,11 +2521,14 @@ class Parameter: # Add annotation and default value if self._annotation is not _empty: - formatted = '{}:{}'.format(formatted, + formatted = '{}: {}'.format(formatted, formatannotation(self._annotation)) if self._default is not _empty: - formatted = '{}={}'.format(formatted, repr(self._default)) + if self._annotation is not _empty: + formatted = '{} = {}'.format(formatted, repr(self._default)) + else: + formatted = '{}={}'.format(formatted, repr(self._default)) if kind == _VAR_POSITIONAL: formatted = '*' + formatted |