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 use object.__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
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
The documentation update accidentally changed
object.__setattr__to just__setattr__here, so now it readsThis line was specifically meant to refer to
object.__setattr__, the__setattr__method of the baseobjectclass, 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