Skip to content

Commit a10cf2f

Browse files
authoredJul 9, 2022
Improve dataclass docstring (gh-94686)
1 parent 78307c7 commit a10cf2f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
 

‎Lib/dataclasses.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -1193,19 +1193,18 @@ def _add_slots(cls, is_frozen, weakref_slot):
11931193
def dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False,
11941194
unsafe_hash=False, frozen=False, match_args=True,
11951195
kw_only=False, slots=False, weakref_slot=False):
1196-
"""Returns the same class as was passed in, with dunder methods
1197-
added based on the fields defined in the class.
1196+
"""Add dunder methods based on the fields defined in the class.
11981197
11991198
Examines PEP 526 __annotations__ to determine fields.
12001199
1201-
If init is true, an __init__() method is added to the class. If
1202-
repr is true, a __repr__() method is added. If order is true, rich
1200+
If init is true, an __init__() method is added to the class. If repr
1201+
is true, a __repr__() method is added. If order is true, rich
12031202
comparison dunder methods are added. If unsafe_hash is true, a
1204-
__hash__() method function is added. If frozen is true, fields may
1205-
not be assigned to after instance creation. If match_args is true,
1206-
the __match_args__ tuple is added. If kw_only is true, then by
1207-
default all fields are keyword-only. If slots is true, an
1208-
__slots__ attribute is added.
1203+
__hash__() method is added. If frozen is true, fields may not be
1204+
assigned to after instance creation. If match_args is true, the
1205+
__match_args__ tuple is added. If kw_only is true, then by default
1206+
all fields are keyword-only. If slots is true, a new class with a
1207+
__slots__ attribute is returned.
12091208
"""
12101209

12111210
def wrap(cls):

0 commit comments

Comments
 (0)
Please sign in to comment.