3 ms·
You probably already know but you can add type hints and then check for consistency with https://github.com/python/mypy https://github.com/python/mypy in python
by kingkongjaffa 3y ago
You probably already know but you can add type hints and then check for consistency with https://github.com/python/mypy https://github.com/python/mypy in python.
Modern Python with things like https://learnpython.com/blog/python-match-case-statement/ https://learnpython.com/blog/python-match-case-statement/ + mypy + Ruff for linting https://github.com/astral-sh/ruff https://github.com/astral-sh/ruff can get pretty good results.
I found typed dataclasses (https://docs.python.org/3/library/dataclasses.html https://docs.python.org/3/library/dataclasses.html) in python using mypy to give me really high confidence when building data representations.
And there's https://pypi.org/project/django-stubs/ https://pypi.org/project/django-stubs/ for working with Django.
- catlover76 3y agoThings like MyPy and Pyre end up being a pain to setup, in part because of an annoying and unautomated "stub" ecosystem (it was like back in the day when you had to manually install or declare types for every JS package used in a TypeScript project). It really just doesn't feel as good or useful as using a statically typed language.