]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] dataclasses docs: add some link anchors (GH-117601) (#117863)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 14 Apr 2024 08:10:07 +0000 (10:10 +0200)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2024 08:10:07 +0000 (08:10 +0000)
dataclasses docs: add some link anchors (GH-117601)
(cherry picked from commit c99d374fc7327ebd47e22c3b1906bc865aad80a1)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Doc/library/dataclasses.rst

index ae90d85e8d3149ef99c211cc341f3ae7d65a982e..95b746d81dfde68e6b7314bcfb2aca38a526aed2 100644 (file)
@@ -554,6 +554,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
 ---------------
 
@@ -565,6 +567,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-variables:
+
 Init-only variables
 -------------------
 
@@ -596,6 +600,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
 ----------------
 
@@ -609,6 +615,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
 -----------