Python is dynamic and type-typed duck - variables can change type, and you cannot impose types on methods.
However, you can check the types in the body of the method using isinstance().
isinstance() isinstance() enum . -
from enum import Enum
class Direction(Enum):
LEFT = "left"
RIGHT = "right"
UP = "up"
DOWN = "down"
def move(direction):
if not isinstance(direction, Direction):
raise TypeError('direction must be an instance of Direction Enum')
print direction.value
>>> move(Direction.LEFT)
left
>>> move("right")
TypeError: direction must be an instance of Direction Enum