https://mypy-lang.org
mypy - Optional Static Typing for Python
mypy, mypy language, python static typing, python, python optional styping, optional typing, python type checker
Mypy is an optional static type checker for Python.
mypy - Optional Static Typing for Python Home Blog Examples Docs GitHub Wiki Roadmap About Contact Twitter Newsletter Atom Follow: Get the Code on GitHub! Mypy on Twitter is @mypyproject Follow @mypyproject on Twitter Why mypy? Compile-time type checking Static typing makes it easier to find bugs with less debugging. Easier maintenance Type declarations act as machine-checked documentation. Static typing makes your code easier to understand and easier to modify without introducing bugs. Grow your programs from dynamic to static typing You can develop programs with dynamic typing and add static typing after your code has matured, or migrate existing Python code to static typing. mypy Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing. Mypy combines the expressive power and convenience of Python with a powerful type system and compile-time type checking. Mypy type checks standard Python programs; run them using any Python VM with basically no runtime overhead. What's new Mypy 1.11 released 19 Jul 2024: Mypy 1.11 was released. Read the blog post for the details. -Max Murin Mypy 1.10 released 24 Apr 2024: Mypy 1.10 was released. Read the blog post for the details. -Valentin Stanciu Mypy 1.9 released 08 Mar 2024: Mypy 1.9 was released. Read the blog post for the details. -Jared Hance Mypy 1.8 released 21 Dec 2023: Mypy 1.8 was released. Read the blog post for the details. -Wesley Collin Wright Older news Seamless dynamic and static typing From Python... def fib(n): a, b = 0, 1 while a < n: yield a a, b = b, a+b ...to statically typed Python def fib(n: int) -> Iterator[int]: a, b = 0, 1 while a < n: yield a a, b = b, a+b Migrate existing code to static typing, a function at a time. You can freely mix static and dynamic typing within a program, within a module or within an expression. No need to give up dynamic typing — use static typing when it makes sense. Often just adding function signatures gives you statically typed code. Mypy can infer the types of other variables. Python syntax Mypy type checks programs that have type annotations conforming to PEP 484. Getting started is easy if you know Python. The aim is to support almost all Python language constructs in mypy. Powerful type system Mypy has a powerful, modern type system with features such as bidirectional type inference, generics, callable types, abstract base classes, multiple inheritance and tuple types. Access to Python libs Many commonly used libraries have stubs (statically typed interface definitions) that allow mypy to check that your code uses the libraries correctly. Learn more Follow the mypy status blog. Browse code examples. Read the documentation. Read the FAQ. © 2014 the mypy project · Content available under a Creative Commons license · Contact · Atom feed
https://mypy-lang.org
سایت خود را ویرایش کنید؟
چیکار میکنی؟