Skip to content

Commit 573b186

Browse files
committed
address review comments
1 parent f65d9a4 commit 573b186

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,9 @@ def _field_names(class_or_instance):
13951395
13961396
Accepts a dataclass or an instance of one. Excludes pseudo-fields.
13971397
"""
1398-
13991398
return getattr(class_or_instance, _FIELD_NAMES)
14001399

1400+
14011401
def _is_dataclass_instance(obj):
14021402
"""Returns True if obj is an instance of a dataclass."""
14031403
return hasattr(type(obj), _FIELDS)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Improve performance of :func:`dataclasses.asdict` up to 40%.
1+
Improve performance of :func:`dataclasses.asdict` up to 40% by caching the field names on dataclass classes.

0 commit comments

Comments
 (0)