Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: