https://github.com/python/cpython/commit/b22460c44d1bc597c96d4a3d27ad8373d7952820
commit: b22460c44d1bc597c96d4a3d27ad8373d7952820
branch: main
author: Étienne Pelletier <etiennepellet...@users.noreply.github.com>
committer: ambv <luk...@langa.pl>
date: 2025-05-19T16:10:17+02:00
summary:

gh-125225: Fix column misalignment in help('topics') output (gh-125226)

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.

Co-authored-by: Łukasz Langa <luk...@langa.pl>

files:
M Lib/pydoc.py

diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index def76d076a2989..7528178fdcae97 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -2110,7 +2110,7 @@ def intro(self):
         self.output.write(_introdoc())
 
     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):
@@ -2142,7 +2142,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:

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to