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: Add the field type to Field repr #77698

Closed
ericvsmith opened this issue May 15, 2018 · 3 comments
Closed

dataclasses: Add the field type to Field repr #77698

ericvsmith opened this issue May 15, 2018 · 3 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ericvsmith
Copy link
Member

BPO 33517
Nosy @ericvsmith, @ned-deily, @miss-islington
PRs
  • bpo-33517: dataclasses: Add the field type to Field repr #6858
  • [3.7] bpo-33517: dataclasses: Add the field type to Field repr (GH-6858) #6859
  • 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-05-15.13:08:55.411>
    created_at = <Date 2018-05-15.12:01:16.951>
    labels = ['3.7', '3.8', 'type-feature', 'library']
    title = 'dataclasses: Add the field type to Field repr'
    updated_at = <Date 2018-05-15.13:08:55.410>
    user = 'https://github.com/ericvsmith'

    bugs.python.org fields:

    activity = <Date 2018-05-15.13:08:55.410>
    actor = 'eric.smith'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2018-05-15.13:08:55.411>
    closer = 'eric.smith'
    components = ['Library (Lib)']
    creation = <Date 2018-05-15.12:01:16.951>
    creator = 'eric.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33517
    keywords = ['patch']
    message_count = 3.0
    messages = ['316644', '316651', '316652']
    nosy_count = 3.0
    nosy_names = ['eric.smith', 'ned.deily', 'miss-islington']
    pr_nums = ['6858', '6859']
    priority = None
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue33517'
    versions = ['Python 3.7', 'Python 3.8']

    @ericvsmith
    Copy link
    Member Author

    With the recent (and ongoing) change to string annotations, it's no longer obvious what the type of a field is (normal, ClassVar, or InitVar).

    I propose exposing the heretofore undocumented _field_type to the repr. Instead of writing it directly, I'm going to make it say one of:

    _field_type=_FIELD
    _field_type=_FIELD_CLASSVAR
    _field_type=_FIELD_INITVAR

    This is because it's an object reference, and would otherwise look like:

    _field_type=<object object at 0x10cc5f1f0>

    Which is all but useless.

    @ericvsmith ericvsmith added release-blocker 3.7 (EOL) end of life 3.8 only security fixes labels May 15, 2018
    @ericvsmith ericvsmith self-assigned this May 15, 2018
    @ericvsmith ericvsmith added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 15, 2018
    @ericvsmith
    Copy link
    Member Author

    New changeset 01abc6e by Eric V. Smith in branch 'master':
    bpo-33517: dataclasses: Add the field type to Field repr (GH-6858)
    01abc6e

    @miss-islington
    Copy link
    Contributor

    New changeset 5c7e079 by Miss Islington (bot) in branch '3.7':
    bpo-33517: dataclasses: Add the field type to Field repr (GH-6858)
    5c7e079

    @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 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants