Skip to content

Commit ac4e5d2

Browse files
miss-islingtonfregataaclaude
authored
[3.15] gh-149083: Document that dataclasses.MISSING and KW_ONLY are sentinels (GH-155919) (#155927)
Co-authored-by: Sanghun Lee <sanghun@lablup.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c811e85 commit ac4e5d2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Doc/library/dataclasses.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ Module contents
262262
c = C()
263263
c.mylist += [1, 2, 3]
264264

265-
As shown above, the :const:`MISSING` value is a sentinel object used to
266-
detect if some parameters are provided by the user. This sentinel is
265+
As shown above, the :const:`MISSING` value is a :class:`sentinel` object
266+
used to detect if some parameters are provided by the user. This sentinel is
267267
used because ``None`` is a valid value for some parameters with
268268
a distinct meaning. No code should directly use the :const:`MISSING` value.
269269

@@ -523,11 +523,14 @@ Module contents
523523

524524
.. data:: MISSING
525525

526-
A sentinel value signifying a missing default or default_factory.
526+
A :class:`sentinel` object signifying a missing default or *default_factory*.
527+
528+
.. versionchanged:: 3.15
529+
:const:`!MISSING` is now a :class:`sentinel` object.
527530

528531
.. data:: KW_ONLY
529532

530-
A sentinel value used as a type annotation. Any fields after a
533+
A :class:`sentinel` object used as a type annotation. Any fields after a
531534
pseudo-field with the type of :const:`!KW_ONLY` are marked as
532535
keyword-only fields. Note that a pseudo-field of type
533536
:const:`!KW_ONLY` is otherwise completely ignored. This includes the
@@ -552,6 +555,9 @@ Module contents
552555

553556
.. versionadded:: 3.10
554557

558+
.. versionchanged:: 3.15
559+
:const:`!KW_ONLY` is now a :class:`sentinel` object.
560+
555561
.. exception:: FrozenInstanceError
556562

557563
Raised when an implicitly defined :meth:`~object.__setattr__` or

0 commit comments

Comments
 (0)