Let's say I define the following function with typed arguments:
from typing import List
def map_names_to_ages(names: List[str], ages: List[int]):
return { name: ages[index] for index, name in enumerate(names) }
And I have another function with the same arguments:
def generate_sentence(names: List[str], ages: List[int]):
return [f"{name} is {ages[index]} years old" for index, name in enumerate(names)]
What if I want to define the typed input arguments only once? Can I save and reuse them somehow? Something like this:
args = ...
def map_names_to_ages(args):
...
def generate_sentence(args):
...