Skip to content

Commit

Permalink
Clarify need for attr.ib for attr decorator validators
Browse files Browse the repository at this point in the history
Ref #466
  • Loading branch information
hynek committed Oct 1, 2019
1 parent 08bbaab commit f083cd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ You can use a decorator:
...
ValueError: value out of bounds

Please note that the decorator approach only works if -- and only if! -- the attribute in question has an ``attr.ib`` assigned.
Therefore if you use ``@attr.s(auto_attribs=True)``, it is *not* enough to decorate said attribute with a type.

``attrs`` ships with a bunch of validators, make sure to `check them out <api_validators>` before writing your own:

Expand Down

0 comments on commit f083cd7

Please sign in to comment.