Can I indicate a specific dictionary shape/form for an argument to a function in python?
Like in typescript I'd indicate that the info
argument should be an object with a string name
and a number age
:
function parseInfo(info: {name: string, age: number}) { /* ... */ }
Is there a way to do this with a python function that's otherwise:
def parseInfo(info: dict):
# function body
Or is that perhaps not Pythonic and I should use named keywords or something like that?