[Python-ideas] Pre-conditions and post-conditions
Jacco van Dorp
j.van.dorp at deonet.nl
Mon Aug 27 03:04:21 EDT 2018
Total noob speaking here, but....
Those contracts are mostly important during development right ? Slowdown
isn't that much of an issue during development. So you could make a debug
mode that enforces the contracts, and a production mode that code users can
use during production to stop the slowdown - in this case, your decorators
can return their functions/classes unaltered. If they do end up with
problems, you can always ask them to run the same inputs with debug mode on
to see where it goes wrong.
For the rest, i'm totally new to design by contract. I do get the draw of
it, but im not sure if I'd ever really use it. I tend to solve my problems
with a royal sprinkling of logger.debug(f"{val_i_need_to_check}").
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180827/e59ffdd2/attachment.html>
More information about the Python-ideas
mailing list