2 ms·
A great feature of pydantic are the validation hooks that let you intercept serialization/deserialization of specific fields and augment behavior. For example
by mbb70 1y ago
A great feature of pydantic are the validation hooks that let you intercept serialization/deserialization of specific fields and augment behavior.
For example if you are querying a DB that returns a column as a JSON string, trivial with Pydantic to json parse the column are part of deser with an annotation.
Pydantic is definitely slower and not a 'zero cost abstraction', but you do get a lot for it.
- jtmcivor 1y agoOne approach to do that in msgspec is described here https://github.com/jcrist/msgspec/issues/375#issuecomment-1520301756 https://github.com/jcrist/msgspec/issues/375#issuecomment-15...