Python from Wise Guy's Viewpoint

Marshall Spight mspight at dnai.com
Thu Oct 23 00:39:31 EDT 2003


"Pascal Costanza" <costanza at web.de> wrote in message news:bn774d$qj3$1 at newsreader2.netcologne.de...
> >
> > When do programmers know better?  An int is an int and a string is a
> > string, and nary the twain shall be treated the same.  I would rather
> > ``1 + "bar"'' signal an error at compile time than at run time.
>
> Such code would easily be caught very soon in your unit tests.

Provided you think to write such a test, and expend the effort
to do so. Contrast to what happens in a statically typed language,
where this is done for you automatically.

Unit tests are great; I heartily endorse them. But they *cannot*
do everything that static type checking can do. Likewise,
static type checking *cannot* do everything unit testing
can do.

So again I ask, why is it either/or? Why not both? I've had
*great* success building systems with comprehensive unit
test suites in statically typed languages. The unit tests catch
some bugs, and the static type checking catches other bugs.


Marshall






More information about the Python-list mailing list