On Oct 29, 3:47 am, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > I am wondering if there is any work on contracts for Python. I could > only find PEP316, however, I am wondering if there is any official > support for it already (tools I mean), and if it is or if it will be > officially supported in any of the next releases of Python.
It's possible to get a simplistic design-by-contract approach without external libs by using 'assert'. Here's a modified example from PEP 316: class circbuf: def __init__(self, leng): """Construct an empty circular buffer.""" # pre assert leng > 0, "pre: length not positive" ... # post assert self.is_empty(), "post: buffer not empty" assert len(self.buf) == leng, "post: buffer length incorrect" -- http://mail.python.org/mailman/listinfo/python-list