does lack of type declarations make Python unsafe?

Moshe Zadka m at moshez.org
Mon Jun 16 13:22:00 EDT 2003


I have always been slightly at odds with the XP community, and I
think your post shows why acutely:

On Mon, 16 Jun 2003, Peter Hansen <peter at engcorp.com> wrote:

> Without tests, source code is a liability, not an asset.

That's, of course, correct but terribly misleading. Source code,
with or without tests, is always a liability. Sometimes a liability
you compromise for, because you need functionality which, with
or without tests, is an asset. Co-workers from the first company
I worked for still remember me gleefully deleting reams of code
I made unnecessary muttering "less code, less bugs". 

Sure, tests sometimes reduce bugs. And sometimes not. And sometimes
they reduce bugs, but less than what you would have accomplished
if you did something else. Sometimes, of course, tests are the
best way to fix bugs. The important thing to realize is "not always".
Sometimes, your time is better spent *not* writing tests. The best
example I have here is the mail program I use, PMS. It has no tests.
None. Nada. It's still reliable. python-slides, a cool package
by itamar which makes slides from Python source, has no tests.
I'd trust it with my life sooner than many other things.
 
I tend to write code, and then write tests if and when I get to them.
Sometimes, I only write tests before a big refactor. Sometimes,
I do the big refactor and just check several command-line options
manually to check it hasn't broken. Following a religion, like "always
write tests first", has always looked silly to me. Sorry :)
-- 
Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/





More information about the Python-list mailing list