-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
Feature or enhancement
Proposal:
Problem
Currently, when a user enters an invalid input into help() (e.g., a misspelled function name or a non-existent function), the response is simply:
No Python documentation found for 'invalid_input'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
This doesn't help users who may have made a typo or are unsure of the correct function name. It would be more user-friendly if help() could suggest similar, valid commands from the available documentation in both the built-in Python modules and any currently imported modules.
Proposed Feature
When a user enters an invalid function or method name, help() should return a suggestion of closely related commands from the built-in and imported modules. For example, if the user types a misspelled method name, help() should suggest the correct method(s) from the current environment.
Example Usage
Input
help('pandas.duplicated()')
Output
Did you mean: help('pandas.DataFrame.duplicated')
Input
help('math.sqrted')
Output
Did you mean: help('math.sqrt')?
Benefits
- Increased usability: The suggestion mechanism can assist users in quickly finding the relevant commands without the need to remember the exact function names.
- Reduced confusion: By providing related commands, it can help users avoid frustration and save time looking for documentation.
- Improved Python learning experience: Beginners will have a smoother experience when exploring Python’s functions and classes, making it easier to learn and use Python effectively.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response