Mention attr.fields() after __attrs_attrs__ in 'How does it work' (#605)

* Mention attr.fields() after __attrs_attrs__ in 'How does it work'

The mentioning of __attrs_attrs__ in a 'how does it work' document makes sense but it seems important to mention that there are good non-dunder ways to access the data.

* Correct how-does-it-work.rst change to use semantic newlines

* it's attr not attrs...

* Simplify attr.fields link
This commit is contained in:
Kyle Altendorf 2020-01-03 09:37:39 -05:00 committed by Hynek Schlawack
parent aa55c68efd
commit 3fff9ee352
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,8 @@ No magic, no meta programming, no expensive introspection at runtime.
Everything until this point happens exactly *once* when the class is defined.
As soon as a class is done, it's done.
And it's just a regular Python class like any other, except for a single ``__attrs_attrs__`` attribute that can be used for introspection or for writing your own tools and decorators on top of ``attrs`` (like `attr.asdict`).
And it's just a regular Python class like any other, except for a single ``__attrs_attrs__`` attribute that ``attrs`` uses internally.
Much of the information is accessible via `attr.fields` and other functions which can be used for introspection or for writing your own tools and decorators on top of ``attrs`` (like `attr.asdict`).
And once you start instantiating your classes, ``attrs`` is out of your way completely.