Idiomatic algebraic data types in Python with dataclasses and Union
Greetings from 2024! An official pattern matching PEP has been accepted https://peps.python.org/pep-0636/ and is available in Python 3.10. Class patterns are tested using isinstance, with no inheritance structure necessary, making the pattern described in this post 100% forward compatible to real pattern matching. One of the features I miss most in non-Haskell programming languages is […]