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

dataclasses: use function dispatch instead of multiple tests for adding __hash__ #77315

Closed
ericvsmith opened this issue Mar 24, 2018 · 4 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir

Comments

@ericvsmith
Copy link
Member

BPO 33134
Nosy @rhettinger, @ericvsmith, @miss-islington
PRs
  • bpo-33134: dataclasses: use function dispatch table for hash, instead of a string lookup which then is tested with if tests. #6222
  • [3.7] bpo-33134: dataclasses: use function dispatch table for hash, instead of a string lookup which then is tested with if tests. (GH-6222) #6224
  • 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/ericvsmith'
    closed_at = <Date 2018-03-25.02:32:58.183>
    created_at = <Date 2018-03-24.21:11:21.831>
    labels = ['3.8', '3.7', 'library']
    title = 'dataclasses: use function dispatch instead of multiple tests for adding __hash__'
    updated_at = <Date 2018-03-25.02:32:58.183>
    user = 'https://github.com/ericvsmith'

    bugs.python.org fields:

    activity = <Date 2018-03-25.02:32:58.183>
    actor = 'eric.smith'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2018-03-25.02:32:58.183>
    closer = 'eric.smith'
    components = ['Library (Lib)']
    creation = <Date 2018-03-24.21:11:21.831>
    creator = 'eric.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33134
    keywords = ['patch']
    message_count = 4.0
    messages = ['314385', '314389', '314390', '314391']
    nosy_count = 3.0
    nosy_names = ['rhettinger', 'eric.smith', 'miss-islington']
    pr_nums = ['6222', '6224']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33134'
    versions = ['Python 3.7', 'Python 3.8']

    @ericvsmith
    Copy link
    Member Author

    There's already a table lookup for what action to take when adding __hash__. Change it to a function dispatch table, instead of using strings and testing them.

    @ericvsmith ericvsmith added 3.7 (EOL) end of life 3.8 only security fixes labels Mar 24, 2018
    @ericvsmith ericvsmith self-assigned this Mar 24, 2018
    @ericvsmith ericvsmith added the stdlib Python modules in the Lib dir label Mar 24, 2018
    @rhettinger
    Copy link
    Contributor

    +1

    @ericvsmith
    Copy link
    Member Author

    New changeset 01d618c by Eric V. Smith in branch 'master':
    bpo-33134: dataclasses: use function dispatch table for hash, instead of a string lookup which then is tested with if tests. (GH-6222)
    01d618c

    @miss-islington
    Copy link
    Contributor

    New changeset 9989efb by Miss Islington (bot) in branch '3.7':
    bpo-33134: dataclasses: use function dispatch table for hash, instead of a string lookup which then is tested with if tests. (GH-6222)
    9989efb

    @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 stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants