William Woodruff personal blog
Approximating sum types in Python with Pydantic
TL;DR: You can use Pydantic’s support for tagged unions to approximate sum types in Python; go right to Sum types in Python (and onwards) to see how it’s done.
- Points
- 158
- HN comments
- 97
- Submissions
- 1
- Cited by
- 0 commenters
Software EngineeringProgramming Languages2024
On Hacker News
| Submitted | Title on HN | Points | Comments |
|---|---|---|---|
| Aug 12, 2024 | Approximating sum types in Python with Pydantic by woodruffw | 158 | 97 |