def make_point_3d(pt):
match pt:
case (x, y):
return Point3d(x, y, 0)
case (x, y, z):
return Point3d(x, y, z)
case Point2d(x, y):
return Point3d(x, y, 0)
case Point3d(_, _, _):
return pt
case _:
raise TypeError("not a point we support")
match and case keyword aren't highlighted with the Monokai-Contrast theme:
Newly in Python 3.10 is the Structural Pattern Matching.
match
andcase
keyword aren't highlighted with the Monokai-Contrast theme: