▲ | Spivak 2 hours ago | |
Type hints alone don't do this, but you can use Pydantic to accomplish what you want. In Python type hints aren't enforced anywhere at runtime. They're for a type-checker to validate your source. https://docs.pydantic.dev/latest/concepts/validation_decorat... |