◐ Shell
clean mode source ↗

Minor mistake in dataclasses documentation update

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