docs: re-shuffle intro

This commit is contained in:
Hynek Schlawack 2024-03-16 15:14:06 +01:00
parent 70bc90a53b
commit 9c1f649983
No known key found for this signature in database
2 changed files with 11 additions and 9 deletions

View File

@ -91,7 +91,16 @@ After *declaring* your attributes, *attrs* gives you:
*without* writing dull boilerplate code again and again and *without* runtime performance penalties.
**Hate type annotations**!?
---
This example uses *attrs*'s modern APIs that have been introduced in version 20.1.0, and the *attrs* package import name that has been added in version 21.3.0.
The classic APIs (`@attr.s`, `attr.ib`, plus their serious-business aliases) and the `attr` package import name will remain **indefinitely**.
Check out [*On The Core API Names*](https://www.attrs.org/en/latest/names.html) for an in-depth explanation!
### Hate Type Annotations!?
No problem!
Types are entirely **optional** with *attrs*.
Simply assign `attrs.field()` to the attributes instead of annotating them with types:
@ -105,13 +114,6 @@ class SomeClass:
list_of_numbers = field(factory=list)
```
---
This example uses *attrs*'s modern APIs that have been introduced in version 20.1.0, and the *attrs* package import name that has been added in version 21.3.0.
The classic APIs (`@attr.s`, `attr.ib`, plus their serious-business aliases) and the `attr` package import name will remain **indefinitely**.
Check out [*On The Core API Names*](https://www.attrs.org/en/latest/names.html) for an in-depth explanation!
## Data Classes

View File

@ -4,7 +4,7 @@ In order to fulfill its ambitious goal of bringing back the joy to writing class
```{include} ../README.md
:start-after: 'code-begin -->'
:end-before: '## Project Information'
:end-before: '### Hate Type Annotations!?'
```