This PEP is one of three related to type hinting. This PEP gives a literature overview of related work. The main spec is PEP 484.
(This section is a stub, since mypy is essentially what we’re proposing.)
Reticulated Python by Michael Vitousek is an example of a slightly different approach to gradual typing for Python. It is described in an actual academic paper written by Vitousek with Jeremy Siek and Jim Baker (the latter of Jython fame).
PyCharm by JetBrains has been providing a way to specify and check types for about four years. The type system suggested by PyCharm grew from simple class types to tuple types, generic types, function types, etc. based on feedback of many users who shared their experience of using type hints in their code.
TBD: Add sections on pyflakes, pylint, numpy, Argument Clinic, pytypedecl, numba, obiwan.
ActionScript is a class-based, single inheritance, object-oriented superset of ECMAScript. It supports interfaces and strong runtime-checked static typing. Compilation supports a “strict dialect” where type mismatches are reported at compile-time.
Example code with types:
Dart is a class-based, single inheritance, object-oriented language with C-style syntax. It supports interfaces, abstract classes, reified generics, and optional typing.
Types are inferred when possible. The runtime differentiates between two modes of execution: checked mode aimed for development (catching type errors at runtime) and production mode recommended for speed execution (ignoring types and asserts).
Example code with types:
Hack is a programming language that interoperates seamlessly with PHP. It provides opt-in static type checking, type aliasing, generics, nullable types, and lambdas.
Example code with types:
TypeScript is a typed superset of JavaScript that adds interfaces, classes, mixins and modules to the language.
Type checks are duck typed. Multiple valid function signatures are specified by supplying overloaded function declarations. Functions and classes can use generics as type parameterization. Interfaces can have optional fields. Interfaces can specify array and dictionary types. Classes can have constructors that implicitly add arguments as fields. Classes can have static fields. Classes can have private fields. Classes can have getters/setters for fields (like property). Types are inferred.
Example code with types:
This document has been placed in the public domain.
Source: https://github.com/python/peps/blob/main/peps/pep-0482.rst
Last modified: 2025-02-01 08:59:27 UTC