forked from python/cpython
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now we only use dict for slots with metadata
- Loading branch information
Showing
3 changed files
with
54 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
11 changes: 7 additions & 4 deletions
11
Misc/NEWS.d/next/Library/2024-01-14-11-43-31.gh-issue-113878.dmEIN3.rst
This file contains 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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
Add ``doc`` parameter to :func:`dataclasses.field`, so it can be stored and | ||
shown as a documentation / metadata. | ||
It is only visible when ``@dataclass(slots=True)`` is used. | ||
Add *doc* parameter to :func:`dataclasses.field`, so it can be stored and | ||
shown as a documentation / metadata. If ``@dataclass(slots=True)`` is used, | ||
then the supplied string is availabl in the :object:`__slots__` dict. Otherwise, | ||
the supplied string is only available in the corresponding | ||
:class:`dataclasses.Field` object. | ||
|
||
In order to support this feature we are changing the ``__slots__`` format | ||
in dataclasses from :class:`tuple` to :class:`dict`. | ||
in dataclasses from :class:`tuple` to :class:`dict` | ||
when documentation / metadata is present. |