Python Type Hinting

Python 3+ has type annotations that can be used for static type checking using a separate program. There are several competing type checkers (mypy, pyright, pyre) that can be used that are sponsored by different companies (Facebook, Microsoft).

See also:

  • Python Data Classes Are Shorthand Structs

    A Python dataclass simplifies the setup of a class with many attributes. By adding the `datacass` decorator to a `Class` you can any number of typed attributes and it will generate an `__init__` method for you with default values. This is convenient when you are modeling a data heavy application and using classes (rather than dicts) to get better type check errors.