[Python-ideas] Pre-conditions and post-conditions

Steven D'Aprano steve at pearwood.info
Wed Aug 29 08:16:09 EDT 2018


I didn't want to embarass Ivan any further by seemingly picking on his 
opinion about contracts being always statically checked, but when I 
asked off-list I got told to reword and post it here. So here it is.

Sorry Ivan if this makes you feel I'm picking on you, that isn't my 
intention.


On Mon, Aug 27, 2018 at 12:25:44PM +0100, Jonathan Fine wrote:

[..]
> Based on the Eiffel docs, I find Ivan's opinion reasonable. He said it
> was "one of the main points". The goal is to detect errors
> immediately. Run-time assertion monitoring and static typing are two
> means towards that end.

Ivan said that static checking was a main point. Those Eiffel docs which 
you (Jonathon) quoted approvingly describe them as "run-time 
assertions". You describe them as "run-time assertions". I described 
them as "run-time assertions". So I'm having difficulty in understand 
what part of Ivan's opinion that they are compile-time static checks is 
"reasonable".

If there's something I'm missing about Ivan's comment that you can see, 
I'd like to be enlightened. I don't see the relevance of the "two means 
towards that end" -- we have many means towards detecting bugs as early 
as possible:

- correctness proofs
- test-driven development
- type checking
- design by contract

(and possibly more). If it was just a throw-away comment and I'm reading 
more into it than you intended, that's okay too, but I'd like to 
understand what you meant.


> Our shared problem and goal is to have similar immediate detection of
> errors in Python (when the development process requires that degree of
> rigour).

Well, yes, but what's that got to do with the question of whether 
contracts are checked statically or at runtime?



-- 
Steve


More information about the Python-ideas mailing list