> On 23 Sep 2018, at 11:13, Angus Hollands <goose...@gmail.com> wrote: > > Hi Marko, > > I think there are several ways to approach this problem, though am not > weighing in on whether DbC is a good thing in Python. I wrote a simple > implementation of DbC which is currently a run-time checker. You could, with > the appropriate tooling, validate statically too (as with all approaches). In > my approach, I use a “proxy” object to allow the contract code to be defined > at function definition time. It does mean that some things are not as pretty > as one would like - anything that cannot be hooked into with magic methods > i.e isinstance, but I think this is acceptable as it makes features like old > easier. Also, one hopes that it encourages simpler contract checks as a > side-effect. Feel free to take a look - https://github.com/agoose77/pyffel > <https://github.com/agoose77/pyffel> > It is by no means well written, but a fun PoC nonetheless. > This is an interesting PoC, nice work! I like that its easy to read the tests.
Given a library like this the need to build DbC into python seems unnecessary. What do other people think? Barry > Regards, > Angus > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/