Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the "less" prompt in pydoc #120541

Closed
serhiy-storchaka opened this issue Jun 15, 2024 · 0 comments
Closed

Improve the "less" prompt in pydoc #120541

serhiy-storchaka opened this issue Jun 15, 2024 · 0 comments
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jun 15, 2024

In #65824 the "Help on ..." was added in the "less" prompt in pydoc. It works good in the CLI or hen you call help() with a string, but unfortunately, it is not so good for help() used in the REPL with non-string argument. For example, help(str) has a prompt starting with "Help on type ", and help(str.upper) -- "Help on method_descriptor ". In the latter case, the help text itself is started with "Help on method_descriptor:", but this is a different issue.

The proposed PR improves the prompt. It now uses the objects __qualname__ or __name__ if they are available (this covers classes, functions, methods, and many others), and falls back to "{typename} object" otherwise.

Linked PRs

@serhiy-storchaka serhiy-storchaka added 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jun 15, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jun 15, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
serhiy-storchaka added a commit that referenced this issue Jun 15, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 15, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
(cherry picked from commit 31d1d72)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit that referenced this issue Jun 15, 2024
…120562)

When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
(cherry picked from commit 31d1d72)

Co-authored-by: Serhiy Storchaka <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes
Projects
None yet
Development

No branches or pull requests

1 participant