Verification (pytyp.spec.check)

This module provides routines to verify type specifications.

A value is verified in one of four ways:

  1. If the value is a subclass of the specification.
  2. If the value’s class is registered with the specification (using the register() method).
  3. If the value is registered with the specification (using the register_instance() method).
  4. If the value is a container that can be iterated over and whose contents can be verified.

The last of these must inspect all values, so can be inefficient.

Hint

Don’t forget that type specifications also work with isinstance() and issubclass().

Checked

Verify