[New-bugs-announce] [issue43451] pydoc terminal suboptimal rendering of complex annotations

David Wilson report at bugs.python.org
Tue Mar 9 14:12:29 EST 2021


New submission from David Wilson <dw at botanicus.net>:

When viewing docs for classes that use annotations, pydoc's rendering of argument lists is regularly truncated at the terminal edge (if using `less -S`), or wrapped in a manner where quickly scanning the output is next to impossible.

My 'classic' example is 'pydoc aiohttp.client.ClientSession', where the __init__ argument list wraps to 24 lines.

The pull request attached to this issue works around the problem by formatting arguments one-per-line if the sum of the arguments would exceed a hard-coded width of 150 characters. It is more of an RFC than a suggested fix. It produces acceptable formatting, but I'm not sure where the correct fix should be made -- in the inspect module, or somehow in the pydoc module, or even what the correct fix shuld be.

I will include a before/after screenshot in the pull request

I will attach before/after screenshot

----------
components: Library (Lib)
messages: 388373
nosy: dw
priority: normal
severity: normal
status: open
title: pydoc terminal suboptimal rendering of complex annotations
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43451>
_______________________________________


More information about the New-bugs-announce mailing list