3

Maybe more of a bit of a random curiosity than a proper technical question, but I was wondering whether there were any tools within the Python ecosystem that both support static typing via type hints (e.g. mypy) and code compilation (like with Cython) using these type hints. Does such a tool currently exist?

Ideally said tool would be used to both enforce the types used in the code base during compilation and produce some runtime speed benefits (I know I'm greedy)...

Liam Deacon
  • 904
  • 1
  • 9
  • 25
  • 2
    [Cython pure Python mode](https://cython.readthedocs.io/en/latest/src/tutorial/pure.html) isn't quite what you're after (doesn't use the standard type hints), but it's close. – DavidW Oct 03 '18 at 07:58
  • See also answer to [this FAQ question](http://doc.pypy.org/en/latest/faq.html#would-type-annotations-help-pypy-s-performance) for explanation why mypy-style hints are not as useful for optimizers as they appear at first. – user4815162342 Jun 27 '19 at 15:01

0 Answers0