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

improve some error messages of min() and max() #75419

Closed
orenmn mannequin opened this issue Aug 18, 2017 · 3 comments
Closed

improve some error messages of min() and max() #75419

orenmn mannequin opened this issue Aug 18, 2017 · 3 comments
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@orenmn
Copy link
Mannequin

orenmn mannequin commented Aug 18, 2017

BPO 31236
Nosy @serhiy-storchaka, @orenmn
PRs
  • bpo-31236: improve some error messages of min() and max() #3146
  • 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 = None
    closed_at = <Date 2017-08-21.17:19:59.063>
    created_at = <Date 2017-08-18.21:51:19.299>
    labels = ['interpreter-core', 'type-feature', '3.7']
    title = 'improve some error messages of min() and max()'
    updated_at = <Date 2017-08-21.17:19:59.061>
    user = 'https://github.com/orenmn'

    bugs.python.org fields:

    activity = <Date 2017-08-21.17:19:59.061>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-08-21.17:19:59.063>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2017-08-18.21:51:19.299>
    creator = 'Oren Milman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31236
    keywords = []
    message_count = 3.0
    messages = ['300539', '300565', '300644']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'Oren Milman']
    pr_nums = ['3146']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31236'
    versions = ['Python 3.7']

    @orenmn
    Copy link
    Mannequin Author

    orenmn mannequin commented Aug 18, 2017

    currently, we have the following:
        >>> min(0, a=1)
        TypeError: 'a' is an invalid keyword argument for this function
        >>> max(0, a=1)
        TypeError: 'a' is an invalid keyword argument for this function
        >>> max(0, a=1, b=2, c=3)
        TypeError: function takes at most 2 arguments (3 given)
        >>> min(0, a=1, b=2, c=3)
        TypeError: function takes at most 2 arguments (3 given)
    
    ISTM it would be preferable for min() and max() to have error messages similar
    to those of int():
        >>> int(0, a=1)
        TypeError: 'a' is an invalid keyword argument for int()
        >>> int(0, a=1, b=2)
        TypeError: int() takes at most 2 arguments (3 given)

    we can achieve this by making a small change in Python/bltinmodule.c in
    min_max (I would open a PR soon), and by resolving bpo-31229.

    @orenmn orenmn mannequin added type-bug An unexpected behavior, bug, or error topic-IO 3.7 (EOL) end of life labels Aug 18, 2017
    @serhiy-storchaka
    Copy link
    Member

    LGTM.

    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement and removed topic-IO type-bug An unexpected behavior, bug, or error labels Aug 19, 2017
    @serhiy-storchaka
    Copy link
    Member

    New changeset 58cf748 by Serhiy Storchaka (Oren Milman) in branch 'master':
    bpo-31236: Improved some error messages of min() and max().
    58cf748

    @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 interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant