> raise KeyError(key) This would be flagged as unreachable I believe. mypy/pyright also supports exhaustive checking with unions def get_activation(key: Literal['sigmoid', 'tanh']) -> nn.Module: match key: case…
> If you enforce them then you can't do duck typing, This is a little misleading as mypy and pyright both support structural typing.
> raise KeyError(key) This would be flagged as unreachable I believe. mypy/pyright also supports exhaustive checking with unions def get_activation(key: Literal['sigmoid', 'tanh']) -> nn.Module: match key: case…
> If you enforce them then you can't do duck typing, This is a little misleading as mypy and pyright both support structural typing.