FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-149083: Document that dataclasses.MISSING and KW_ONLY are sentinels (GH-155919) by miss-islington · Pull Request #155927 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
14 changes: 10 additions & 4 deletions Doc/library/dataclasses.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ Module contents
c = C()
c.mylist += [1, 2, 3]

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

Expand Down Expand Up @@ -523,11 +523,14 @@ Module contents

.. data:: MISSING

A sentinel value signifying a missing default or default_factory.
A :class:`sentinel` object signifying a missing default or *default_factory*.

.. versionchanged:: 3.15
:const:`!MISSING` is now a :class:`sentinel` object.

.. data:: KW_ONLY

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

.. versionadded:: 3.10

.. versionchanged:: 3.15
:const:`!KW_ONLY` is now a :class:`sentinel` object.

.. exception:: FrozenInstanceError

Raised when an implicitly defined :meth:`~object.__setattr__` or
Expand Down
Loading

Back | FazBrowse Home | New Git URL