From 762b9571c9c8c6b036f1bf90140a1d030b3f9a01 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 16 Nov 2017 03:30:59 +0900 Subject: bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408) --- Lib/inspect.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Lib/inspect.py') 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 -- cgit v1.2.1