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

Parsing of math expression inside ad-hoc Numpy contracts #19

Open AndreaCensi opened 10 years ago

AndreaCensi commented 10 years ago

This does not parse correctly:

 @contract(x='int,M', returns='array[(2*M+1),(2*M+1)](int)'))

and neither this:

 @contract(x='int,M', returns='array[2*M+1),2*M+1](int)'))