News for hackers. Stuff that matters.
Re:Approximating sum types in Python with Pydantic by mattarm on Wednesday August 14, 2024 @11:30AM (#41247239)
In my experience learning a bit of OCaml after Rust, and then looking at Haskell, the three aren't all that different in terms of the basics of how ADTs are declared and used, especially for the simpler cases.
Re:Approximating sum types in Python with Pydantic by jghn on Wednesday August 14, 2024 @11:42AM (#41247376)
Agreed. As a concept they're all the same thing.

Another way of phrasing my query is that given these are all basically ML-style constructs, why would the examples not be ML? And I was assuming the answer to that is "the sorts of people reading these blogs in 2024 are more familiar with Rust"

Re:Approximating sum types in Python with Pydantic by runeblaze on Wednesday August 14, 2024 @12:16PM (#41247765)
I think a second reason might be that translating OCaml/Haskell concepts to Python has that academic connotation to it. Rust also (thanks to PyO3) has more affinity to Python than the ML languages. I guess it isn't a surprise that this post has Python, C++, and Rust, all "commonly" used for Python libraries.