Statically typed Python - MyPy. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

30th Jun 2018, 8:20 AM
Alihuseyn Kengerli
Alihuseyn Kengerli - avatar
1 Answer
+ 1
thanks for sharing
30th Jun 2018, 4:53 PM
$ยข๐Žโ‚น๐”ญ!๐จ๐“
$ยข๐Žโ‚น๐”ญ!๐จ๐“ - avatar