On Sun, 23 Apr 2006 05:36 am, Talin wrote:
> @precondition( y=NotNegative )
> def power( x, y ):
>    ...
> ...where 'NotNegative' is a function which simply does an assert( value >= 
0 )
The phrase "y=NotNegative" is a classic type constraint predicate.

Given that type expressions will be dynamic (see GVD blog 
http://www.artima.com/weblogs/viewpost.jsp?thread=87182)  
how about:

def power(x, y : NotNegative):
   body...

or

def power(x, y : not Negative):
   body...

or even:

def power(x, y : (lambda t: t > 0) ):
   body...
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to