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

Get rid of trailing comma in the repr() of BaseException #74584

Closed
serhiy-storchaka opened this issue May 18, 2017 · 3 comments
Closed

Get rid of trailing comma in the repr() of BaseException #74584

serhiy-storchaka opened this issue May 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

@serhiy-storchaka
Copy link
Member

BPO 30399
Nosy @terryjreedy, @serhiy-storchaka
PRs
  • bpo-30399: Get rid of trailing comma in the repr of BaseException. #1650
  • 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-11-15.15:54:13.976>
    created_at = <Date 2017-05-18.15:32:17.794>
    labels = ['interpreter-core', 'type-feature', '3.7']
    title = 'Get rid of trailing comma in the repr() of BaseException'
    updated_at = <Date 2017-11-15.15:54:13.975>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-11-15.15:54:13.975>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-15.15:54:13.976>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2017-05-18.15:32:17.794>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30399
    keywords = []
    message_count = 3.0
    messages = ['293928', '293977', '306278']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'serhiy.storchaka']
    pr_nums = ['1650']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30399'
    versions = ['Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    The repr() of BaseException (and all exceptions that don't override __repr__) with a single argument contains a redundant trailing comma:

    >>> BaseException('spam')
    BaseException('spam',)

    This is just an artefact of the implementation.

    Proposed patch removes this comma.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels May 18, 2017
    @serhiy-storchaka serhiy-storchaka changed the title Get rid of trailing comma if the repr() of BaseException Get rid of trailing comma in the repr() of BaseException May 19, 2017
    @terryjreedy
    Copy link
    Member

    I think the trailing comma is slightly worse than redundant, as someone who has forgotten the trailing comma rule for calls can mistakenly read it as making the arg a tuple. So +1 on removing it.

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset f8a4c03 by Serhiy Storchaka in branch 'master':
    bpo-30399: Get rid of trailing comma in the repr of BaseException. (bpo-1650)
    f8a4c03

    @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

    2 participants