doc: update statement in examples

This commit is contained in:
Hynek Schlawack 2023-10-09 15:13:17 +02:00
parent 5f1d588a66
commit bd443b0191
No known key found for this signature in database
GPG Key ID: AE2536227F69F181
1 changed files with 4 additions and 2 deletions

View File

@ -448,7 +448,7 @@ TypeError: ("'x' must be <type 'int'> (got '42' that is a <type 'str'>).", Attri
``` ```
Please note that if you use {func}`attr.s` (and **not** {func}`attrs.define`) to define your class, validators only run on initialization by default -- not when you set an attribute. Please note that if you use {func}`attr.s` (and **not** {func}`attrs.define`) to define your class, validators only run on initialization by default -- not when you set an attribute.
This behavior can be changed using the `on_setattr` argument. This behavior can be changed using the *on_setattr* argument.
Check out {ref}`validators` for more details. Check out {ref}`validators` for more details.
@ -467,7 +467,9 @@ This can be useful for doing type-conversions on values that you don't want to f
1 1
``` ```
Please note that converters only run on initialization. Please note that converters only run on initialization when using the old-school {func}`attr.s` decorator.
They do run by default with {func}`attrs.define` and friends.
This behavior can be changed using the *on_setattr* argument.
Check out {ref}`converters` for more details. Check out {ref}`converters` for more details.