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 sobolevn
Recipients NeilGirdhar, eric.smith, sobolevn
Date 2022-02-19.07:09:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645254591.59.0.820107811012.issue46757@roundup.psfhosted.org>
In-reply-to
Content
I like this idea.

`attrs` right now behave the same way (no default `__attrs_post_init__`:

```
>>> import attrs
>>> @attrs.define
... class Some:
...   x: int
... 
>>> @attrs.define
... class Other(Some):
...    def __attrs_post_init__(self):
...       super().__attrs_post_init__()
...       self.x += 1
... 
>>> Other(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<attrs generated init __main__.Other>", line 3, in __init__
  File "<stdin>", line 4, in __attrs_post_init__
AttributeError: 'super' object has no attribute '__attrs_post_init__'
```

I am attaching a simple patch.

Alternative solution is to not merge this patch and recommend this instead:

```
def __post_init__(self):
  try:
    super().__post_init__()
  except AttributeError:
    pass
```
History
Date User Action Args
2022-02-19 07:09:51sobolevnsetrecipients: + sobolevn, eric.smith, NeilGirdhar
2022-02-19 07:09:51sobolevnsetmessageid: <1645254591.59.0.820107811012.issue46757@roundup.psfhosted.org>
2022-02-19 07:09:51sobolevnlinkissue46757 messages
2022-02-19 07:09:51sobolevncreate