PEP 3107 and stronger typing (note: probably a newbie question)

Alex Martelli aleax at
Wed Jul 4 17:32:06 CEST 2007

Roy Smith <roy at> wrote:

> greg <greg at> wrote:
> > Paul Rubin wrote:
> > > E.g. your program might pass its test and run properly for years
> > > before some weird piece of input data causes some regexp to not quite
> > > work.
> > 
> > Then you get a bug report, you fix it, and you add a test
> > for it so that particular bug can't happen again.
> The TDD zealots would tell you you've got the order wrong.  Instead of
> "fix, then write a test", it should be "write a failing test, then fix it".

Incidentally, I was pretty surprised recently (re-reading Weinberg's
"Psychology of Computer Programming" classic from _1971_) to find out
Weinberg advocating "test-first coding" (not the same thing as
"test-driven design", but sharing the key insight that tests should be
written before the code they test) for psychological reasons. He's
discussing common practices of the '60s, with the same professional
writing both the code and the tests, and pointing out how often the
knowledge of the already-written code subconsciously influences the
programmer to write tests that don't really "challenge" the code enough
-- writing the tests "in advance" would avoid this problem.

Nihil sub sole novi...


More information about the Python-list mailing list