On Tue, Apr 19, 2022 at 9:43 AM <tmkehrenberg@gmail.com> wrote:
Unions do not implement isinstance
Unions do support isinstance since python 3.10 but apparently they do not support pattern matching. This feels like an oversight to me. If unions did support pattern matching, then do you think they would be a sufficient replacement for sealed classes?
What would be the syntax? The same as a class match? match x: case Nickle(): ... case Dime(): ... case Coin(): ... # Assume this is the union Would such a union support arguments? Could we write match x: case Nickle(value=pennies): ... case Coin(value=pennies): ... ? -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>