News for hackers. Stuff that matters.
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!
Re:Proposing a Struct Syntax for Python by masklinn on Wednesday June 14, 2023 @03:53PM (#36331637)
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.