You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is now possible to wrap a converter into an `attrs.Converter` and get the current instance and/or the current field definition passed into the converter callable.
2
+
3
+
Note that this is not supported by any type checker, yet.
Copy file name to clipboardExpand all lines: docs/init.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -361,6 +361,24 @@ A converter will override an explicit type annotation or `type` argument.
361
361
{'return': None, 'x': <class 'str'>}
362
362
```
363
363
364
+
If you need more control over the conversion process, you can wrap the converter with a {class}`attrs.Converter` and ask for the instance and/or the field that are being initialized:
0 commit comments