AndreaCensi / contracts

PyContracts is a Python package that allows to declare constraints on function parameters and return values. Contracts can be specified using Python3 annotations, or inside a docstring. PyContracts supports a basic type system, variables binding, arithmetic constraints, and has several specialized contracts and an extension API.
http://andreacensi.github.io/contracts/
Other
398 stars 62 forks source link

Suggestion: Accept '0 <= int < $square_size' and 'tuple(A, B), 0 <= A < $nr_rows, 0 <= B < $nr_cols' kind of conditions in contracts #67

Open jcrmatos opened 6 years ago

jcrmatos commented 6 years ago

Hello,

Please consider accepting as contract conditions these syntax example:

@contract(square_nr='0 <= int < $square_size',
          returns='tuple(A, B), 0 <= A < $nr_rows, 0 <= B < $nr_cols')

Thanks,

JM