
June 1, 2003
10:59 p.m.
On Sun, Jun 01, 2003 at 05:17:10PM +0100, Paul Moore wrote:
But I disagree fairly strongly with the idea of having pre/post conditions in docstrings. That is *not* what docstrings are for. Docstrings are documentation, not arbitrary metadata.
How about this as a proposal? Attach pre and post conditions to a functions as function attributes. A silly example:
FWIW, I stumbled across an implementation of contracts for Python that works more or less in the manner you describe: http://www.nongnu.org/pydbc/ I agree that contracts shouldn't be in docstrings. I confess though, that is because I know editor indenting and syntax highlighting won't handle it smoothly ;) -- Agthorr