
8 Jan
2022
8 Jan
'22
10:32 a.m.
08.01.22 01:59, jack.jansen@cwi.nl пише:
If I can make a wild suggestion: why not create a little language for type specifications?
We need a way to define aliases. For example, write:
Data = Mapping[str, Sequence[Tuple[int, T]]] Factory = Callable[[int, Iterable[str]], Optional[list[Data[T]]]]
def get_foo_factory(type: str, id: int) -> Factory[Foo]: ...
instead of
def get_foo_factory(type: str, id: int) -> Callable[[int, Iterable[str]], Optional[list[Mapping[str, Sequence[Tuple[int, Foo]]]]]]: ...