-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Documentation
Data Classes - Mutable default values says in the second blockquote
x: list = [] # This code raises **ValueError**
but in the explanantion (two paragraphs down) it notes:
Instead, the dataclass decorator will raise a TypeError if it detects an unhashable default parameter.
This is inconsistent, in fact a ValueError is raised, cf. https://github.com/python/cpython/blob/e8e59ee474869e7c02e7cae3815c9c2183671b21/Lib/dataclasses.py#L848C1-L853C1
Linked PRs
- gh-106107: document correct error that's raised when a mutable default value for a field is detected #106109
- [3.12] gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109) #106115
- [3.11] gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109) #106116
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir