
Steven D'Aprano wrote:
On Sun, Dec 06, 2020 at 10:22:53AM -0000, redradist@gmail.com wrote:
It would be nice to have "Typed Python" mode that will look like this: #!/usr/bin/env bash
set -e python -m mypy $1 python $1
What does that mean? Why is it a bash script?
It is only example how I use what I call "Typed Python" The same can happens under-hood, python in this "typed" mode can first run type-checker and then if there are no errors run script itself
It could be achieved by adding special flag like -t (typed) What does "typed" mode do? Why would it be "nice"? If all you want is to run mypy, you can run mypy. Or any alternative type-checker, such as Pytype, Pyright, Pyre or Jedi: https://google.github.io/pytype/ https://github.com/Microsoft/pyright https://pyre-check.org/ https://pypi.org/project/jedi (Jedi does a lot more than just type checking.)
It would be good to have direct support from python to run script in typed mode or not ... Python can support other type checker with some option `--type-checker=<path> or <name>` of module that will type-check