Open bushraqurban opened 6 days ago
the response is simply
BTW, you might query for docs differently:
>>> help(abt)
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
help(abt)
^^^
NameError: name 'abt' is not defined. Did you mean: 'abs'?
>>> help(abs)
Help on built-in function abs in module builtins:
abs(x, /)
Return the absolute value of the argument.
This is a minor feature, which does not need previous discussion elsewhere
I doubt it's a minor feature. You examples demonstrate, that a "helper" for the help() will be assumed to do very non-trivial things, for external projects like Pandas - too. It's not clear (1) how exactly, (2) at which cost (there possible security, performance issues, etc).
IMO, this kind of stuff should be first discussed on the https://discuss.python.org/c/ideas/6. Preferably, with much more detailed proposal to show how this may work algorithmically.
Thanks for your feedback! I really appreciate your input. I see your point about the complexity of implementing this feature, especially for third-party packages like Pandas. I’ll take some time to consider these issues more carefully, particularly how we can limit the scope of the suggestions to only trusted modules and imported libraries. I’m planning to explore solutions that balance usability and performance.
I’ll follow up with a more detailed proposal once I’ve thought through the details. Thanks again for your insights!
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