Dec-28-2022, 04:20 AM
As shown below, may anyone help to explain what does the
I had tried these
x: int
and y: int
does in the point class? Source code from [here](https://docs.python.org/3/tutorial/contr...statements)class Point: x: int y: int def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point")And also how could I run the above code to obtain each case match?
I had tried these
>>> where_is((1,0)) Not a point >>> where_is((Point)) Not a point