Re:Proposing a Struct Syntax for Python
by tikhonj on Wednesday June 14, 2023 @01:32PM
(#36329411)
Right, the article talks about "type Point = Point1D | Point2D | Point3D" syntax at the end... which would work just as well with dataclasses as with structs!
[ Parent
| on HN ]
It already does too. Just remove the `type` bit and you have an alias for a union, which has been supported since typing was added (though the `|` syntax was only added in 3.10). And AFAIK the type checkers do handle completeness on unions.