[Python-ideas] Pre-conditions and post-conditions

Michel Desmoulin desmoulinmichel at gmail.com
Sat Sep 8 14:09:16 EDT 2018


Isn't the purpose of "assert" to be able to do design by contract ?

    assert test, "error message is the test fail"

I mean, you just write your test, dev get a feedback on problems, and
prod can remove all assert using -o.

What more do you need ?

Le 15/08/2018 à 23:06, Marko Ristin-Kaufmann a écrit :
> Hi,
> 
> I would be very interested to bring design-by-contract into python 3. I
> find design-by-contract particularly interesting and indispensable for
> larger projects and automatic generation of unit tests.
> 
> I looked at some of the packages found on pypi and also we rolled our
> own solution (https://github.com/Parquery/icontract/
> <https://github.com/Parquery/icontract/>). I also looked into
> https://www.python.org/dev/peps/pep-0316/
> <https://www.python.org/dev/peps/pep-0316/>.
> 
> However, all the current 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.
> 
> Could somebody update me on the state of the discussion on this matter?
> 
> I'm very grateful for any feedback on this!
> 
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 


More information about the Python-ideas mailing list