Python Annotations

Mypy

Mypy is an optional static type checker for Python.

pip install mypy or python -m pip install mypy

Code Examples

a:int = 10

def func(x:float,y:list[str]) -> str: ... ... return 'abc'

Links

mypy (home)

mypy 1.8.0 Documentation
mypy 1.8.0 Cheat Sheet

Typing — Support for Type Hints

Function Annotations in Python

What is the best alternative to mypy?

Windows Batch File

@echo off rem =========================================== rem mypy rem =========================================== echo( echo ---------------- run mypy ---------------- echo( set /p f="Enter python file name : " IF %f%x EQU x ( exit ) python -m mypy "%f%" pause