does lack of type declarations make Python unsafe?

Peter Hansen peter at engcorp.com
Mon Jun 16 14:53:04 EDT 2003


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

Don't mistake me for the XP community.  I'm just me.

> 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. 

I shortened it from a previous post, in which I continued 
"Source code with good unit and acceptance tests is an asset."

Sounds like you wouldn't agree.

For my company, it's very clear that it's true, however, so I guess
once again (surprise!) I speak only for myself.  :-)

> 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".
[snip]
> 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 :)

I agree.  Good thing we don't actually *always* write tests, nor
always write them first.  ;-)

Don't mistake strong claims for religion either...  I make them
to spur the truly test-less on to consider and investigate and
practice writing tests, because _they_ are the ones who are 
writing crappy code, not you, who might understand when to test 
and when not to test.

-Peter




More information about the Python-list mailing list