duck-type-checking?

greg greg at cosc.canterbury.ac.nz
Sat Nov 15 02:00:03 EST 2008


Joe Strout wrote:

> So, in this case, the simplest solution was to have the method that  
> initially accepts and stores the data check to make sure that data  
> satisfies the assumptions of the class.

In hindsight, yes, but the trouble is that you can't
tell ahead of time which of the gazillion places in the
code that where you store things away in containers are
likely to cause a problem later.

I can't imagine myself writing code to check every
argument to every method to guard against this sort of
thing. If you're willing to do that, it's up to you,
but it's far from common practice in Python programming.

-- 
Greg




More information about the Python-list mailing list