Static typing (was: Python from Wise Guy's Viewpoint)

Holger Krekel pyth at devel.trillke.net
Thu Oct 23 06:53:39 EDT 2003


Dirk Thierbach wrote:
> Pascal Costanza <costanza at web.de> wrote:
> > You need some testing discipline, which is supported well by unit 
> > testing frameworks.
> 
> IMHO it helps to think about static typing as a special kind of unit
> tests. Like unit tests, they verify that for some input values, the
> function in question will produce the correct output values. Unlike
> unit tests, they do this for a class of values, instead of testing
> statistically by example. And unlike unit tests, they are pervasive:
> Every execution path will be automatically tested; you don't have
> to invest brain power to make sure you don't forget one.

IMHO typical unit-tests in python go a lot further than just testing
types. They test *behaviour* rather than just types.  Thus I tend to
think that for languages like python unittests are a *perfect match*
because there is hardly any redundancy and they are very short to write
down usually.  Writing unittests in a statically typed language is more
redundant because - like you say - type declarations already are a kind
of (IMO very limited) tests. 

cheers,

    holger





More information about the Python-list mailing list