Python from Wise Guy's Viewpoint

Erann Gat spammers_must_die at jpl.nasa.gov
Fri Oct 24 18:01:53 EDT 2003


In article <bnc4bg$r6s$1 at f1node01.rhrz.uni-bonn.de>, Pascal Costanza
<costanza at web.de> wrote:

> Marshall Spight wrote:
> > "Pascal Costanza" <costanza at web.de> wrote in message
news:bn8nhq$l04$1 at f1node01.rhrz.uni-bonn.de...
> > 
> >>In a statically typed language, when I write a test case that calls a
> >>specific method, I need to write at least one class that implements at
> >>least that method, otherwise the code won't compile.
> >>
> >>In a dynamically typed language I can concentrate on writing the test
> >>cases first and don't need to write dummy code to make some arbitrary
> >>static checker happy.
> > 
> > 
> > This is a non-issue. In both cases, you need the implementing code
> > if you want to be able to run the testcase, and you don't need the
> > implementing code if you don't.
> 
> No, in a dynamically typed language, I don't need the implementation to 
> be able to run the testcase.
> 
> Among other things:
> 
> - the test cases can serve as a kind of todo-list. I run the testsuite, 
> and it gives me an exception. This shows what portion of code I can work 
> on next.
> 
> - when a test case gives me an exception, I can inspect the runtime 
> environment and analyze how far the test case got, what it already 
> successfully did, what is missing, and maybe even why it is missing. 
> With a statically typed language, I wouldn't be able to get that far.

To be fair, you can do both of those things in statically typed langauges
too, except that you get the error at compile time rather than run time.

> Furthermore, when I am still in the exceptional situation, I can change 
> variable settings, define a function on the fly, return some value from 
> a yet undefined method by hand to see if it can make the rest of the 
> code work, and so on.

This is a good point.

E.




More information about the Python-list mailing list