Skip to content

Commit 4885c5b

Browse files
carltongibsonhynek
andauthored
docs: use modern field API in 'boilerplate' section. (#1535)
* docs: use modern field API in 'boilerplate' section. * Adjust for review comment * Tweak to second sentence. * Apply suggestion from @hynek --------- Co-authored-by: Hynek Schlawack <hs@ox.cx>
1 parent 25b74d6 commit 4885c5b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/how-does-it-work.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
*attrs* isn't the first library that aims to simplify class definition in Python.
88
But its **declarative** approach combined with **no runtime overhead** lets it stand out.
99

10-
Once you apply the `@attrs.define` (or `@attr.s`) decorator to a class, *attrs* searches the class object for instances of `attr.ib`s.
11-
Internally they're a representation of the data passed into `attr.ib` along with a counter to preserve the order of the attributes.
12-
Alternatively, it's possible to define them using {doc}`types`.
10+
Once you apply the `@attrs.define` (or `@attr.s`) decorator to a class, *attrs* searches the class object for type hints and instances of `attrs.field`s.
11+
Internally `field`s are a representation of the data passed, along with a counter to preserve the order of the attributes.
1312

1413
In order to ensure that subclassing works as you'd expect it to work, *attrs* also walks the class hierarchy and collects the attributes of all base classes.
1514
Please note that *attrs* does *not* call `super()` *ever*.

0 commit comments

Comments
 (0)