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

The dataclasses documentation should mention how to call super().__init__ #87724

Closed
ericvsmith opened this issue Mar 19, 2021 · 6 comments
Closed
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir easy

Comments

@ericvsmith
Copy link
Member

BPO 43558
Nosy @ericvsmith, @corona10, @miss-islington, @JunyiXie, @dhoekstra2000
PRs
  • bpo-43558: Add base class initialization to dataclass doc #25967
  • [3.10] bpo-43558: Add note about base class initialization to dataclasses doc (GH-25967) #26018
  • [3.9] bpo-43558: Add note about base class initialization to dataclasses doc (GH-25967) #26019
  • 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 2021-05-10.13:39:25.123>
    created_at = <Date 2021-03-19.14:47:18.001>
    labels = ['easy', '3.8', '3.9', '3.10', 'docs']
    title = 'The dataclasses documentation should mention how to call super().__init__'
    updated_at = <Date 2021-05-10.13:39:25.122>
    user = 'https://github.com/ericvsmith'

    bugs.python.org fields:

    activity = <Date 2021-05-10.13:39:25.122>
    actor = 'eric.smith'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-05-10.13:39:25.123>
    closer = 'eric.smith'
    components = ['Documentation']
    creation = <Date 2021-03-19.14:47:18.001>
    creator = 'eric.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43558
    keywords = ['patch', 'easy', 'newcomer friendly']
    message_count = 6.0
    messages = ['389097', '393114', '393115', '393391', '393392', '393393']
    nosy_count = 5.0
    nosy_names = ['eric.smith', 'corona10', 'miss-islington', 'JunyiXie', 'dhoekstra']
    pr_nums = ['25967', '26018', '26019']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43558'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @ericvsmith
    Copy link
    Member Author

    https://docs.python.org/3/library/dataclasses.html#post-init-processing should mention that if you need to call super().__init__, you should do it in __post_init__. Dataclasses cannot know what parameters to pass to the super class's __init__, so you'll need to do it yourself manually in __post_init__.

    @ericvsmith ericvsmith self-assigned this Mar 19, 2021
    @ericvsmith ericvsmith added 3.8 only security fixes 3.9 only security fixes labels Mar 19, 2021
    @ericvsmith ericvsmith self-assigned this Mar 19, 2021
    @ericvsmith ericvsmith added 3.10 only security fixes 3.8 only security fixes docs Documentation in the Doc dir 3.9 only security fixes easy labels Mar 19, 2021
    @dhoekstra2000
    Copy link
    Mannequin

    dhoekstra2000 mannequin commented May 6, 2021

    I'd like to fix this. Since this would be my first contribution ever, I will need some time to figure out procedures and style requirements regarding documentation. I estimate this will take me no longer than 3 days.

    @ericvsmith
    Copy link
    Member Author

    Sure. Take your time! Thank you in advance for your contribution.

    @ericvsmith
    Copy link
    Member Author

    New changeset 4d532d3 by Miss Islington (bot) in branch '3.9':
    bpo-43558: Add note about base class initialization to dataclasses doc (GH-25967) (GH-26019)
    4d532d3

    @ericvsmith
    Copy link
    Member Author

    New changeset f47305a by Miss Islington (bot) in branch '3.10':
    bpo-43558: Add note about base class initialization to dataclasses doc (GH-25967) (GH-26018)
    f47305a

    @ericvsmith
    Copy link
    Member Author

    Thanks, @dhoekstra!

    @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.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir easy
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant