Respuesta :

PyContracts is a Python package that allows to declare constraints on function parameters and return values. It supports a basic type system, variables binding, arithmetic constraints, and has several specialized contracts (notably for Numpy arrays).

Answer:

In Python programming, this is possible to define some specific constraints on function parameters and return values.  To do so, we can make use of a Python package, PyContracts. PyContracts  enables Python programmer to specify a particular variable type and arithmetic constrains on the function parameters and its return values.

There are three ways to use PyContracts packages:

  1. Using the ``@contract`` decorator
  2. Using annotations
  3. Using docstrings