<div dir="ltr"><div><div><div><div><div><div><div>Hi python devs,<br><br></div>I would be very interested to bring design-by-contract into python 3. I looked at some of the packages I found on pypi and also we rolled our own solution (<a href="https://github.com/Parquery/icontract/">https://github.com/Parquery/icontract/</a>). I also looked into <a href="https://www.python.org/dev/peps/pep-0316/">https://www.python.org/dev/peps/pep-0316/</a>.<br><br></div>However, all these solutions seem quite clunky to me. The decorators involve an unnecessary computational overhead and the implementation of icontract became quite tricky once we wanted to get the default values of the decorated function.<br><br></div>What do you think about the following solution as an extension to python compiler / interpreter?<br></div><br>* We specify pre- and post-conditions in the docstring.<br></div>* Python interpreter parses these conditions and adapts the corresponding byte codes at the begining and the end of the function body.<br><br></div>I'm very grateful for any feedback on this!<br><br></div>Marko<br></div>