Jonathan Fine wrote:
I've just read and article which makes a good case for providing
pre-conditions and post-conditions.
http://pgbovine.net/python-unreadable.htm
There's nothing in there that talks about PBC-style executable
preconditions and postconditions, it's all about documenting
the large-scale intent and purpose of code. He doesn't put
forward any argument why executable code should be a better
way to do that than writing comments.
Personally I don't think it is. E.g.
def distim(doshes):
for d in doshes:
assert isinstance(d, Dosh)
# do something here
for d in doshes:
assert is_distimmed(d)
This ticks the precondition and postcondition boxes, but
still doesn't give you any idea what a Dosh is and why
you would want to distim it.
--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/