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

IDLE calltips: make positional note less obtrusive #79944

Closed
terryjreedy opened this issue Jan 17, 2019 · 5 comments
Closed

IDLE calltips: make positional note less obtrusive #79944

terryjreedy opened this issue Jan 17, 2019 · 5 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 35763
Nosy @rhettinger, @terryjreedy, @miss-islington
PRs
  • bpo-35763: Make IDLE calltip note about '/' less obtrusive #13791
  • [3.8] bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791) #13830
  • [3.7] bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791) #13831
  • 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:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2019-06-05.04:01:19.397>
    created_at = <Date 2019-01-17.20:01:28.095>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE calltips: make positional note less obtrusive'
    updated_at = <Date 2019-06-05.04:01:19.396>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-06-05.04:01:19.396>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2019-06-05.04:01:19.397>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-01-17.20:01:28.095>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35763
    keywords = ['patch']
    message_count = 5.0
    messages = ['333897', '333899', '344662', '344663', '344664']
    nosy_count = 3.0
    nosy_names = ['rhettinger', 'terry.reedy', 'miss-islington']
    pr_nums = ['13791', '13830', '13831']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35763'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @terryjreedy
    Copy link
    Member Author

    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.

    1. Omit the blank line. We added the blank line to make it clearer that the comment is not part of the docstring. This can be done otherwise.

    2. Change the font to something like smaller, red, italic characters. Issue: the tip string is computed as a whole in the user execution process and inserted in the tip window in the IDLE process.

    3. Shorten and move the comment and mark it with '#'. Most builtins have short signatures, so a short enough comment could be appended to the signature line as a comment. In combination with 0. (and 1., but not visible here), the float tip would shrink from the current

      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.
    1. Limit the number of appearances in a particular session. The following should work.
    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.

    @terryjreedy terryjreedy added type-feature A feature request or enhancement 3.7 (EOL) end of life 3.8 only security fixes labels Jan 17, 2019
    @terryjreedy terryjreedy self-assigned this Jan 17, 2019
    @terryjreedy
    Copy link
    Member Author

    bpo-35764 is about revising the calltip doc, including adding something about '/' in signatures.

    @terryjreedy terryjreedy added 3.9 only security fixes type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Jun 5, 2019
    @terryjreedy
    Copy link
    Member Author

    New changeset 949fe97 by Terry Jan Reedy in branch 'master':
    bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)
    949fe97

    @miss-islington
    Copy link
    Contributor

    New changeset 39346ff by Miss Islington (bot) in branch '3.8':
    bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)
    39346ff

    @miss-islington
    Copy link
    Contributor

    New changeset 3d75bd1 by Miss Islington (bot) in branch '3.7':
    bpo-35763: Make IDLE calltip note about '/' less obtrusive (GH-13791)
    3d75bd1

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants