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
IDLE calltips: make positional note less obtrusive #79944
Comments
bpo-19903 made calltip.getargspec use inspect.signature. The latter may include '/' following positional-only arguments. Slashes are possible for the growing number of C-coded functions processed with Argument Clinic. They appear in both help output and IDLE calltips, but not yet in the regular docs, let alone Python code. The result, for instance, is 'float([x])' in the docs and 'float(x=0, /)' in help() and calltips. Since '/' is effectively undocumented, especially in anything beginners would see, and since there have been questions from beginners as to its meaning, the following note is added to calltips on a new line followed by a blank line: ['/' marks preceding arguments as positional-only] The negative effect is somewhat obtrusively expanding what would typically be 2 lines to 4 in order to say something that hopefully becomes useless. Raymond's bpo-16638 comment about big tips being distracting prompted me to consider some possible (non-exclusive) changes to reduce the impact.
float(x=0, /)
['/' marks preceding arguments as positional-only] Convert a string or number to a floating point number, if possible. back down to float(x=0, /) # / means positional-only
Convert a string or number to a floating point number, if possible.
slash_comments = 3
...
if '/' in sig:
if slash_comments:
slash_comments -= 1
<add slash comment> I think 3 would be about enough. I don't want to make it configurable. Issue: restarting the user execution process would restart the count in that process, where the addition is currently made. If the proposal to use '/' in the regular docs were ever accepted, I would remove the special calltip comment. |
bpo-35764 is about revising the calltip doc, including adding something about '/' in signatures. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: