This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients NeilGirdhar, eric.smith, rhettinger, sobolevn, veky
Date 2022-02-22.03:50:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645501824.42.0.0538275311151.issue46757@roundup.psfhosted.org>
In-reply-to
Content
Note that adding an empty __post_init__ method would be a breaking change.  The following prints out 'B' then 'C'.  But if class A adds an empty __post_init__, then 'B' never gets printed.  The arrangement relies on class A being a passthrough to class B.

    from dataclasses import dataclass

    @dataclass
    class A:
        pass

    @dataclass
    class B:
        def __post_init__(self):
            print('B')

    @dataclass
    class C(A, B):
        def __post_init__(self):
            super().__post_init__()
            print('C')

    c = C()
History
Date User Action Args
2022-02-22 03:50:24rhettingersetrecipients: + rhettinger, eric.smith, NeilGirdhar, veky, sobolevn
2022-02-22 03:50:24rhettingersetmessageid: <1645501824.42.0.0538275311151.issue46757@roundup.psfhosted.org>
2022-02-22 03:50:24rhettingerlinkissue46757 messages
2022-02-22 03:50:24rhettingercreate