docs: re-shuffle intro
This commit is contained in:
parent
70bc90a53b
commit
9c1f649983
18
README.md
18
README.md
|
@ -91,7 +91,16 @@ After *declaring* your attributes, *attrs* gives you:
|
||||||
|
|
||||||
*without* writing dull boilerplate code again and again and *without* runtime performance penalties.
|
*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!
|
No problem!
|
||||||
Types are entirely **optional** with *attrs*.
|
Types are entirely **optional** with *attrs*.
|
||||||
Simply assign `attrs.field()` to the attributes instead of annotating them with types:
|
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)
|
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
|
## Data Classes
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ In order to fulfill its ambitious goal of bringing back the joy to writing class
|
||||||
|
|
||||||
```{include} ../README.md
|
```{include} ../README.md
|
||||||
:start-after: 'code-begin -->'
|
:start-after: 'code-begin -->'
|
||||||
:end-before: '## Project Information'
|
:end-before: '### Hate Type Annotations!?'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue