News for hackers. Stuff that matters.
Re:Algebraic Data Types in Haskell by tiew9Vii on Monday March 28, 2022 @11:38PM (#30838483)
This may be a useful pattern to you. The example is in Java but you should be able to achieve the same in Python https://apocalisp.wordpress.com/2009/08/21/structural-patter....

It’ll get rid of the ‘isinstance’ and give exhaustive matching. I used to use this pattern a lot when wanting ADT’s in a language without ADT’’s.

There are no comments on this comment yet.