Clarity vs. code reuse/generality
steve at REMOVE-THIS-cybersource.com.au
Sat Jul 11 06:01:03 CEST 2009
On Fri, 10 Jul 2009 12:27:25 -0400, Charles Yeomans wrote:
>> (3) assert is absolutely unsuitable for enforcing pre-conditions and
>> conditions, unless such conditions are mere "guidelines", because
>> can be switched off at runtime.
> Unless, of course, you want to switch off such checking at runtime, as
> you might when using a design-by-contract approach.
So is design-by-contract just another way of saying "let's hope the data
is valid, because if it's not, we're screwed"?
Perhaps Python should have a new statement, `assume`, used just like
`assert` except it never actually performs the test or raises an error.
More information about the Python-list