News for hackers. Stuff that matters.
Re:Approximating sum types in Python with Pydantic by woodruffw on Wednesday August 14, 2024 @12:04PM (#41247613)
I think an important piece of context here is that this is not useful for non-ser/de patterns in Python: if all you have is pure Python types that don't need to cross serialization boundaries, then you can do all of this in pure Python (and refine it with Python's very mature type annotations).

In practice, however, Pydantic is one of the most popular packages/frameworks in Python because people do in fact need this kind of complexity. In particular, it makes wrangling complicated object hierarchies that come from REST APIs much easier/error prone.

There are no comments on this comment yet.