From 97fb819c27e96f917357c0001552e22ad7ae552b Mon Sep 17 00:00:00 2001 From: EtiennePelletier Date: Wed, 9 Oct 2024 17:08:18 -0400 Subject: [PATCH] Fix column misalignment in help('topics') output The 'help("topics")' output was misaligned due to "ASSIGNMENTEXPRESSIONS" exceeding the implicit maximum default column width of 19 characters. Reduced the number of columns from 4 to 3 in the listtopics() function to allow more space for longer topic names. --- Lib/pydoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 1839b88fec28b1..d6a892a9e42764 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2093,7 +2093,7 @@ def intro(self): '''.format('%d.%d' % sys.version_info[:2])) def list(self, items, columns=4, width=80): - items = list(sorted(items)) + items = sorted(items) colw = width // columns rows = (len(items) + columns - 1) // columns for row in range(rows): @@ -2125,7 +2125,7 @@ def listtopics(self): Here is a list of available topics. Enter any topic name to get more help. ''') - self.list(self.topics.keys()) + self.list(self.topics.keys(), columns=3) def showtopic(self, topic, more_xrefs=''): try: