Skip to content

Commit fe7ebb0

Browse files
committed
Add example of type-less class
1 parent 18040f5 commit fe7ebb0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,16 @@ After *declaring* your attributes, *attrs* gives you:
9494
**Hate type annotations**!?
9595
No problem!
9696
Types are entirely **optional** with *attrs*.
97-
Simply assign `attrs.field()` to the attributes instead of annotating them with types.
97+
Simply assign `attrs.field()` to the attributes instead of annotating them with types:
98+
99+
```python
100+
from attrs import define, field
101+
102+
@define
103+
class SomeClass:
104+
a_number = field(default=42)
105+
list_of_numbers = field(factory=list)
106+
```
98107

99108
---
100109

0 commit comments

Comments
 (0)