Should we support contracts?
It would be straightforward to support contracts by supporting custom callables in type signatures. For example:
@params(a=int, b=lambda b: b != 0)
def div(a, b):
return a / b
However, I find that syntax clunky (for contracts), compared to something like:
@contract
def div(a, b):
return a / b
@div.requires
def div(a, b):
assert isinstance(a, int)
assert b != 0
But this being typedecorator, not a full-blown contracts library, I'm hesitant to grow it in that direction (unless there's popular demand).
Should we support contracts?
It would be straightforward to support contracts by supporting custom callables in type signatures. For example:
However, I find that syntax clunky (for contracts), compared to something like:
But this being typedecorator, not a full-blown contracts library, I'm hesitant to grow it in that direction (unless there's popular demand).