+ 2
Statically typed Python - MyPy.
MyPy is an optional static type checker for Python. You can add type hints (PEP 484) to your Python programs, and use mypy to type check them statically. Find bugs in your programs without even running them! You can mix dynamic and static typing in your programs. You can always fall back to dynamic typing when static typing is not convenient, such as for legacy code. Here is a small example to whet your appetite (Python 3): ---------------------------------------------------- from typing import Iterator def fib(n: int) -> Iterator[int]: a, b = 0, 1 while a < n: yield a a, b = b, a + b ---------------------------------------------------- https://github.com/gvanrossum/mypy
1 Antwort
+ 1
thanks for sharing