cattrs
cattrs copied to clipboard
Register multiple hooks for a class
- cattrs version: 23.2.3
- Python version: 3.10.12
- Operating System: Ubuntu-22.04
- attrs version: 23.2.0
I mentioned this at the end of another ticket, but I thought it deserved its own issue.
I'd like to register multiple unstructure hooks to a class. Specifically, I want to register subclasses and also omit defaults.
How can I combine this:
include_subclasses(Toy, c, union_strategy=configure_tagged_union)
with this:
hook = make_dict_unstructure_fn(Toy, c, _cattrs_omit_if_default=True)
Thanks :-)
Ben