Russ a écrit : > Bruno Desthuilliers wrote: > >>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 > > > That looks like new syntax to me.
It's the syntax for decorator functions, and it's not that new - it cames with Python 2.4, released November 30, 2004. > Did I miss your point? Yes. -- http://mail.python.org/mailman/listinfo/python-list