8000 bpo-43905: Expand dataclasses.astuple() and asdict() docs by akulakov · Pull Request #26154 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-43905: Expand dataclasses.astuple() and asdict() docs #26154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove tildes in links
  • Loading branch information
akulakov committed Nov 29, 2021
commit fbcc54a907572b782c830f7c7ade46f7fe100377
6 changes: 3 additions & 3 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Module contents
lists, and tuples are recursed into. Other objects are copied with
:func:`copy.deepcopy`.

Example of using :func:`~asdict` on nested dataclasses::
Example of using :func:`asdict` on nested dataclasses::

@dataclass
class Point:
Expand All @@ -349,7 +349,7 @@ Module contents

dict((field.name, getattr(instance, field.name)) for field in fields(instance))

:func:`~asdict` raises :exc:`TypeError` if ``instance`` is not a dataclass
:func:`asdict` raises :exc:`TypeError` if ``instance`` is not a dataclass
instance.

.. function:: astuple(instance, *, tuple_factory=tuple)
Expand All @@ -369,7 +369,7 @@ Module contents

tuple(getattr(instance, field.name) for field in dataclasses.fields(instance))

:func:`~astuple` raises :exc:`TypeError` if ``instance`` is not a dataclass
:func:`astuple` raises :exc:`TypeError` if ``instance`` is not a dataclass
instance.

.. function:: make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False)
Expand Down
0