edc: unfrozen dataclasses are hashble
Open
- Dominant language
- Python
- Stars
- 259
- Forks
- 34
- Avg merge
- 57m
- Merged PRs (30d)
- 1
Description
I think the general consensus in Python is that mutable types should not be hashable; however unfrozen dataclasses are hashable. See code below:
```python
import dataclasses
from etils import edc
@edc.dataclass(allow_unfrozen=True)
@dataclasses.dataclass(eq=True, kw_only=True, frozen=True)
class Conf:
x: int = 3
a = Conf()
a = a.unfrozen()
a.x = 2
hash(a) # should fail
```
ps. edc is really handy
Contributor guide
Assessment
This issue has not been assessed yet.