Typing Support in PyPhysim

PyPhysim has an increasing support for static typing checking.

Ideally everything in PyPhysim should be type checked without errors by mypy and any new code should ideally have typing information as well.

Note

There are other type checkers that can be used, such as pytype (from Google) or pyre (from Facebook)

Some useful information:

FadingGenerator = TypeVar('FadingGenerator',
                          bound=FadingSampleGenerator)
  • Inspecting the type of variables: Use reveal_type(expr) to see the type of expr. It only works in mypy and you get a NameError if you try to run code with it in Python.