status of Programming by Contract (PEP 316)?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu Aug 30 08:07:39 EDT 2007
Russ a écrit :
(snip)
> I don't see how you can avoid adding some new syntax, given that
> Python does not
> currently have syntax for specifying invariants and pre- and post-
> conditions.
class Parrot(object):
@pre(lambda x : x != 42)
@post(lambda result: result != 42)
@invariant(lambda self: self.x == 42)
def reliable_method(self, x):
# your code here
return something
More information about the Python-list
mailing list