Message413536
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
``` |
|
Date |
User |
Action |
Args |
2022-02-19 07:09:51 | sobolevn | set | recipients:
+ sobolevn, eric.smith, NeilGirdhar |
2022-02-19 07:09:51 | sobolevn | set | messageid: <1645254591.59.0.820107811012.issue46757@roundup.psfhosted.org> |
2022-02-19 07:09:51 | sobolevn | link | issue46757 messages |
2022-02-19 07:09:51 | sobolevn | create | |
|