Skip to content

Commit e82cde4

Browse files
committed
docs: add note to make_class about non-NG-ness
fixes #1375
1 parent d3f320e commit e82cde4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/attr/_make.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2868,10 +2868,19 @@ def make_class(
28682868
r"""
28692869
A quick way to create a new class called *name* with *attrs*.
28702870
2871+
.. note::
2872+
2873+
This function is a thin wrapper around `attr.s`, not `attrs.define`
2874+
which means that it doesn't come with some of the improved defaults.
2875+
2876+
For example, if you want the same `on_setattr` behavior as in
2877+
`attrs.define`, you have to pass the hooks yourself: ``make_class(...,
2878+
on_setattr=setters.pipe(setters.convert, setters.validate)``
2879+
28712880
Args:
28722881
name (str): The name for the new class.
28732882
2874-
attrs( list | dict):
2883+
attrs (list | dict):
28752884
A list of names or a dictionary of mappings of names to `attr.ib`\
28762885
s / `attrs.field`\ s.
28772886

0 commit comments

Comments
 (0)