class Pokemon:
def init(self, name: str = “-”, type: str = ‘-’, age : int = ‘-’):
self.name = name
self.type = type
self.age = age
def presentation(self):
print(f’Type of {self.name} : {self.type}\nAge of {self.name} : {self.age}')
I think what you’re looking for is named arguments:
Charizard = Pokemon(‘Charizard’, age=12)
But I’m not completely sure this is what you’re looking for.
EDIT: Ah, no, I think you’re wondering why the type annotation isn’t enforced. Well, Python is a dynamically typed language so there is no enforcement of annotations but you can use static type checkers to to check whether the types are all correct in your code.
EDIT2: Thinking about it even more, I think what you’re looking for is a mechanism to pick an overload of a function based on the type of the supplied arguments. You can use @singledispatch for this from the standard library. But it’s honestly pretty rarely used. I think the correct solution is with the named argument that I had above.