Skip to content
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
6 changes: 6 additions & 0 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ Module contents

assert astuple(p) == (10, 20)
assert astuple(c) == ([(0, 0), (10, 4)],)

The tuple is a :func:`copy.deepcopy` of contained objects, which may
be an issue in some corner cases. To create a shallow copy, the
following workaround may be used::

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

Raises :exc:`TypeError` if ``instance`` is not a dataclass instance.

Expand Down