Skip to content

Commit 98aa688

Browse files
authored
Clarify make_class argument type (#1075)
1 parent 88d2a37 commit 98aa688

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docs/api.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ Core
8585

8686
.. doctest::
8787

88-
>>> C1 = attr.make_class("C1", ["x", "y"])
88+
>>> import attrs
89+
>>> C1 = attrs.make_class("C1", ["x", "y"])
8990
>>> C1(1, 2)
9091
C1(x=1, y=2)
91-
>>> C2 = attr.make_class("C2", {"x": attr.ib(default=42),
92-
... "y": attr.ib(default=attr.Factory(list))})
92+
>>> C2 = attrs.make_class("C2", {
93+
... "x": attrs.field(default=42),
94+
... "y": attrs.field(factory=list)
95+
... })
9396
>>> C2()
9497
C2(x=42, y=[])
9598

src/attr/_make.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,13 +2818,13 @@ def __setstate__(self, state):
28182818

28192819

28202820
def make_class(name, attrs, bases=(object,), **attributes_arguments):
2821-
"""
2821+
r"""
28222822
A quick way to create a new class called *name* with *attrs*.
28232823
28242824
:param str name: The name for the new class.
28252825
28262826
:param attrs: A list of names or a dictionary of mappings of names to
2827-
attributes.
2827+
`attr.ib`\ s / `attrs.field`\ s.
28282828
28292829
The order is deduced from the order of the names or attributes inside
28302830
*attrs*. Otherwise the order of the definition of the attributes is

0 commit comments

Comments
 (0)