AndreaCensi/contracts

Add isNotNone support

gsemet opened this issue · 2 comments

Hello. I propose the following syntax to implement

@contract(arg="notNone")
def function(arg):
  pass

Action: perform the following python code

assert(arg is not None)

I've written up an implementation of this, with tests, if there's any interest in a PR/review. In short it adds the syntax not, which has lower precedence than | or ,, and can be used with None or anything else to negate the contract to the right of it.

Yes, please submit the pull request.

On Thu, Jun 4, 2015 at 3:16 PM, Jonathan Sharpe notifications@github.com
wrote:

I've written up an implementation of this, with tests, if there's any
interest in a PR/review. In short it adds the syntax not, which has lower
precedence than |/,, and can be used with None or anything else to negate
the contract to the right of it.


Reply to this email directly or view it on GitHub
#38 (comment)
.

Andrea Censi | LIDS / MIT | http://censi.mit.edu