[Python-ideas] Why is design-by-contracts not widely adopted?
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Sep 27 01:30:45 EDT 2018
Chris Angelico wrote:
> if you let your API
> docs rot when you make changes that callers need to be aware of, you
> have failed your callers.
Yes, I find that documentation auto-generated from code is
usually a poor substitute for human-written documentation.
Dumping your formally-written contracts into the docs makes
the reader reverse-engineer them to figure out what the
programmer was really trying to say.
Which do you find easier to grok at a glance:
all(L[i] <= L[i+1] for i in range(len(L) - 1))
or
# The list is now sorted
--
Greg
More information about the Python-ideas
mailing list