duck-type-checking?

greg greg at cosc.canterbury.ac.nz
Thu Nov 13 08:33:43 CET 2008


Joe Strout wrote:
> I'd rather risk something that  
> breaks the code in an obvious way during development, than risk  
> something that breaks it in a subtle way and is more likely to be  
> discovered by the end-user.

Seems to me that putting in these kinds of assertions isn't
going to make much difference to the proportion of bugs that
slip through testing.

Your test suite still has to be comprehensive enough to
trigger the assignment of the erroneous object. If it's
not, your assertions won't catch anything. If it is, then
you would have found out during testing in any case.
It might be more difficult to *fix* the problem without
the assertions, but you will still catch it.

-- 
Greg



More information about the Python-list mailing list