Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
Documentation
Description
Thepydoc.Helper.list
function currently uses default values of 80 characters per line and 4 columns. This provides an implicit maximum length of 19 characters per item to ensure columns are aligned properly (the item length is not verified within the function).
Historically, the longest values were_testimportmultiple
fromhelp('module')
andAUGMENTEDASSIGNMENT
fromhelp('topics')
, both with a length of 19 characters.
The recent addition of"ASSIGNMENTEXPRESSIONS"
(21 characters) inPR 124641 causes misaligned columns with these default values. As seen in Python 3.13.0:
>>> help('topics')Here is a list of available topics. Enter any topic name to get more help.ASSERTION DEBUGGING LITERALS SEQUENCESASSIGNMENT DELETION LOOPING SHIFTINGASSIGNMENTEXPRESSIONS DICTIONARIES MAPPINGMETHODS SLICINGSATTRIBUTEMETHODS DICTIONARYLITERALS MAPPINGS SPECIALATTRIBUTESATTRIBUTES DYNAMICFEATURES METHODS SPECIALIDENTIFIERS...
Impact
This misalignment affects the readability of the output, making it a bit more difficult to quickly scan through it.
Proposed Solutions
I see two simple options to address this issue, but I’m open to any other suggestions as well:
Increase the line width to 88 characters:
To preserve the default four columns, a minimum width of 88 characters would be required to ensure each item, including"ASSIGNMENTEXPRESSIONS"
, fits within its column:ASSERTION DEBUGGING LITERALS SEQUENCESASSIGNMENT DELETION LOOPING SHIFTINGASSIGNMENTEXPRESSIONS DICTIONARIES MAPPINGMETHODS SLICINGSATTRIBUTEMETHODS DICTIONARYLITERALS MAPPINGS SPECIALATTRIBUTESATTRIBUTES DYNAMICFEATURES METHODS SPECIALIDENTIFIERS...
Reduce the number of columns to 3 (Recommendation):
Reducing the column count to 3 when listing topics would provide enough space for longer topic names (up to 25 characters). This solution is preferred for compatibility with many terminals that default to 80 characters per line:ASSERTION EXCEPTIONS PACKAGESASSIGNMENT EXECUTION POWERASSIGNMENTEXPRESSIONS EXPRESSIONS PRECEDENCEATTRIBUTEMETHODS FLOAT PRIVATENAMESATTRIBUTES FORMATTING RETURNING...
🙂
Linked PRs
Metadata
Metadata
Assignees
Projects
Status