I defined my class Player in Python3 and now I am trying to define a method in another class that would take an object type Player as a parameter, so a code would look like that:
def change_player_activity(self, player: Player):
pass
But that gives me an error. I know that I could do a following operation:
if not isinstance(player,Player):
raise TypeError
But I am just wondering, is there any built-in way to tell Python3 to accept only the objects of given class?
isinstanceor if you really want to have a go with at it, with metaclasses