-
-
Notifications
You must be signed in to change notification settings - Fork 133
Closed
Description
To (uns)structure certain objects, cattrs allows to register (un)structure hooks. This is a great way to allow (un)structuring of any object, in particular if I cannot modify the underlying classes.
If I have control over the classes, it could be easier to define a (un)structure function or property within the class itself, because this code would reside within each class. During (un)structuring, cattrs could look for the availability of such functions and use the accordingly.
One way to implement that would be to tell the converter to look for a certain method/property (_structure in the example below):
converter.register_structure_property("_structure")What to you think?
BTW: Thanks a lot for cattrs. I love it!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels