Russ a écrit : >>>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. > > > After looking more carefully at your example, I don't think it is as > clean and logical as the > PEP 316 syntax.
Possibly not, but at least it's trivial to implement. > At first I thought that your pre and post-conditions > applied to the class, Pre and post conditions applying to the class ? Now that's an interesting concept. IIRC, Eiffels pre and post conditions only apply to methods, and I fail to see how they could apply to a class. But since you're an expert on the subject, I don't doubt you'll enlighten us ? > but now I realize that they apply to the function. I prefer to see the > conditions inside > the function in the doc string. That just seems more logical to me. Not to me. Doc strings are not for implementation. But if you want to implement a DbC module using doc strings, please do so. > With all due respect, > your proposal is interesting, but I think it overextends the "function > decorator" idea a bit. Definitively not, on the contrary - that's *exactly* what decorators are for. Else, they would be nothing more than HOFs, and there would be no point in having this syntactic sugar. (snip). -- http://mail.python.org/mailman/listinfo/python-list