3 ms·
You can define nested types for args and return values: def foo(bar: dict[int, dict[int, str]]) -> list[tuple[str]] In older (< 3.10 ?) versions you have to i
by sgarland 3y ago
You can define nested types for args and return values:
def foo(bar: dict[int, dict[int, str]]) -> list[tuple[str]]
In older (< 3.10 ?) versions you have to import the classes from the typing module, but other than that it’s the same. You can also define types with the Generic class if you’d rather.
With live checks while you write, it’s pretty easy to do this as you go.