[Python-3000] Generic function PEP won't make it in time

Emin.shopper Martinian.shopper emin.shopper at gmail.com
Thu Apr 26 04:29:13 CEST 2007

On 4/25/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Emin.shopper Martinian.shopper wrote:
> > If you believe that there exist data structures or algorithms where a
> > meaningful unit test takes many minutes or hours,
> I wouldn't be worried about spending minutes to save hours
> later.

OK, but I would rather not have to spend 10 minutes waiting for a unit test
each time I edit a file when I can easily have the test done in seconds at
import time.

As for unit tests taking hours -- I'm skeptical. Do you
> know of algorithms that it's provably impossible to test
> without it taking hours?

Imagine you have to query a database and do something with the resulting
data. Or imagine some complicated network interaction among p2p clients. Or
imagine numerical simulation over a very fine mesh. I've worked on all of
these and the unit-tests can easily take long enough that you don't want to
run them every time you make any changes.

Thirdly -- your program can *still* fail after many hours
> due to one of the many things your static checks don't and
> can't cover.

Of course. I'm not saying ABCs will solve all bugs. What I am saying is that
ABCs provide an easy way to catch simple bugs that can sometimes save you a
lot of time. Sure you could produce fake data for input to your unit-tests
or otherwise contrive things so that you have very quick unit-tests that
really only check if things have the right methods. But if you want a quick
check that derived classes implement the right methods, I think ABCs are a
good solution. At least, they're a solution I find useful. I'm not trying to
advocate that you should use them only that they should be available.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070425/9cca2a15/attachment.htm 

More information about the Python-3000 mailing list