Preconditions - A precondition decorator utility which relies on parameter-name equivalence for conciseness and consistency.
from preconditions import preconditions
@preconditions(lambda i: isinstance(i, int))
def triple(i):
return 3*i
triple(5) in console will return 15, but triple(5,1)v will give an error, because of violating preconditions.
Source: https://pypi.org/project/preconditions/
Postconditions do same, but for output arguments, not for input.
All standard Python functions, with examples of code:
https://docs.python.org/3.8/genindex.html
Comments
Leave a comment