Skip to content

Commit

Permalink
dataclasses docs: add some link anchors
Browse files Browse the repository at this point in the history
These would be useful to link to in the typing spec.
  • Loading branch information
JelleZijlstra committed Apr 7, 2024
1 parent 733e56e commit 2683071
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ See the section below on init-only variables for ways to pass
parameters to :meth:`!__post_init__`. Also see the warning about how
:func:`replace` handles ``init=False`` fields.

.. _dataclasses-class-variables:

Class variables
---------------

Expand All @@ -567,6 +569,8 @@ from consideration as a field and is ignored by the dataclass
mechanisms. Such ``ClassVar`` pseudo-fields are not returned by the
module-level :func:`fields` function.

.. _dataclasses-init-only:

Init-only variables
-------------------

Expand Down Expand Up @@ -598,6 +602,8 @@ value is not provided when creating the class::
In this case, :func:`fields` will return :class:`Field` objects for ``i`` and
``j``, but not for ``database``.

.. _dataclasses-frozen:

Frozen instances
----------------

Expand All @@ -611,6 +617,8 @@ There is a tiny performance penalty when using ``frozen=True``:
:meth:`~object.__init__` cannot use simple assignment to initialize fields, and
must use :meth:`!__setattr__`.

.. _dataclasses-inheritance:

Inheritance
-----------

Expand Down

0 comments on commit 2683071

Please sign in to comment.