[Python-ideas] Pre-conditions and post-conditions
David Mertz
mertz at gnosis.cx
Thu Aug 30 07:22:43 EDT 2018
On Thu, Aug 30, 2018 at 3:44 AM Marko Ristin-Kaufmann <
marko.ristin at gmail.com> wrote:
> Related to the text I emphasized, would you mind to explain a bit more
> in-depth which features you have in mind? I see contracts formally written
> out and automatically verified as a completely indispensable tool in large
> projects with multiple people involved.
>
This much is rather self-evidently untrue. There are hundreds or thousands
of large projects involving multiple people, written in Python, that have
succeeded without using contracts. That suggests the feature is not
"completely indispensable" since it was dispensed with in the vast majority
of large projects.
I think that most of these large projects succeed in large part because
they have good *unit tests*. There are several popular frameworks for
writing these (some in standard library), but notably none of them require
specific syntax changes to make them work. Some of them *do* use DSLs of
sorts as part of how they operate (or various metaprogramming and
introspection magic). There is a whole lot of overlap between what unit
tests do and what design-by-contract does, enough so that I believe the
latter adds little to a large project (of course you can come up with some
specific example that a unit test cannot verify as well as a
pre/postcondition.
In writing before about "features" (and Paul Moore) does a better job than
me in writing about *costs*, I wasn't discussing design-by-contract
specifically. Various new feature ideas come up here and elsewhere. A few
are accepted, most are rejected. They all need to be compared to costs
like those I mention before their possible advantages can win out.
Yours, David...
--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180830/bd2d06a9/attachment.html>
More information about the Python-ideas
mailing list