News for hackers. Stuff that matters.
Re:Approximating sum types in Python with Pydantic by rocgf on Wednesday August 14, 2024 @02:26PM (#41249045)
As it just so happens, I was struggling with this in Python recently and this post describes a better solution than what I came up with.

> Essentially, if this is a feature you must have, Python seems like the wrong language.

While I don't disgree in the absolute sense, there are constraints. You can't just switch language or change the problem you're solving. If you have the need for more type safety, then this is a price worth paying.

There are no comments on this comment yet.