Description
An update to the dataclasses docs, intended to make magic method names link to the relevant data model documentation, accidentally changed a line that shouldn't have been changed.
The docs used to say
There is a tiny performance penalty when using
frozen=True
:__init__()
cannot use simple assignment to initialize fields, and must useobject.__setattr__()
.
The documentation update accidentally changed object.__setattr__
to just __setattr__
here, so now it reads
There is a tiny performance penalty when using
frozen=True
:__init__()
cannot use simple assignment to initialize fields, and must use__setattr__()
.
This line was specifically meant to refer to object.__setattr__
, the __setattr__
method of the base object
class, as simple attribute assignment would hit the frozen dataclass's __setattr__
override.
This part of the documentation should be reverted. I think it should just take a 1-character change, simply removing a tilde.
Linked PRs
- gh-108267: Dataclasses docs line should have said "object.__setattr__" instead of just "__setattr__" #108355
- [3.11] gh-108267: Dataclasses docs: Fix object.__setattr__ typo (GH-108355) #108357
- [3.12] gh-108267: Dataclasses docs: Fix object.__setattr__ typo (GH-108355) #108358
- gh-108267: Fix object.__setattr__ regression in dataclasses docs #119082
- [3.13] gh-108267: Fix object.__setattr__ regression in dataclasses docs (GH-119082) #119097
- [3.12] gh-108267: Fix object.__setattr__ regression in dataclasses docs (GH-119082) #119098
- gh-108267 Fix another dataclasses docs typo #119277
- [3.13] gh-108267 Fix another dataclasses docs typo (GH-119277) #119279
- [3.12] gh-108267 Fix another dataclasses docs typo (GH-119277) #119280