Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3115,7 +3115,13 @@ def __str__(self):
# flag was not reset to 'False'
result.append('/')

rendered = '({})'.format(', '.join(result))
# If arguments are liable exceed to some representative line width,
# write one per line with an indent. Improves pydoc rendering of
# complex annotations.
if (sum(map(len, result)) + (2 * len(result))) > 150:
rendered = '(\n {}\n)'.format(',\n '.join(result))
else:
rendered = '({})'.format(', '.join(result))

if self.return_annotation is not _empty:
anno = formatannotation(self.return_annotation)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Wrap long arguments lists in ``pydoc`` terminal output.