> 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): ...
?
--