-
-
Notifications
You must be signed in to change notification settings - Fork 413
Closed
Description
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 my attr.ibs.
e.g.
from pyrsistent import pmap
@attr.s
class Foo(object):
mapping = attr.ib(coerce=pmap)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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels