I want to use enums in python like in code below (java). I am a greenhorn in Python. I have the following code in Java and want to replicate the functionality in Python:
class Direction {
public enum Direction {LEFT, RIGHT, UP, DOWN}
public void navigate(Direction direction)
switch(direction){
case Direction.LEFT:
System.out.print("left");
break;
case Direction.RIGHT:
System.out.print("right");
break;
case Direction.UP:
System.out.print("up");
break;
case Direction.DOWN:
System.out.print("down");
break;
}
}
How can I enforce users to only provide an enum to a Python method?