ENH: Improve help() to suggest related commands when invalid input is given #127284
Labels
pending
The issue will be closed if no feedback is provided
type-feature
A feature request or enhancement
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:
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
Output
Did you mean: help('pandas.DataFrame.duplicated')
Input
Output
Did you mean: help('math.sqrt')?
Benefits
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
The text was updated successfully, but these errors were encountered: