Allow conversion of parameters #26
Closed
Comments
or... maybe coerce should happen before validation. maybe that is one reason why this hasn't been done yet :) |
Maybe a more generic name like "hook" would be more apt? |
Omg I need this feature. NEED. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd personally be able to get rid of a lot of boilerplate (either at call sites or as
__init__
methods) from my classes if attrs allowed me to supply a conversion callable with myattr.ib
s.e.g.
The
coerce
argument (naming to be bikeshedded) would be called with the value passed in after validation, and the return value would be used as the actual attribute value.Would such a feature be accepted as a patch?
The text was updated successfully, but these errors were encountered: