Could Python supplant Java?

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed Aug 21 12:03:14 CEST 2002


Nicola Musatti <Nicola.Musatti at ObjectWay.it> wrote in 
news:3D6356C5.56BD3D63 at ObjectWay.it:

> So you rewrite a compiler worth of tests on each project? This almost
> sounds as a good reason to stick to statically typed languages: at
> least, half the tests have already been written for you.

Unfortunately the tests the compiler does aren't generally the most useful. 
If you have a function that is supposed to return the total of a list of 
numbers, the compiler might check that you pass in a list of numbers and 
get back a single number as a result. The tests you write may tell you that 
when you pass in the list [1, 2, 3] you get back 6, and when you pass in [] 
you get an IndexError exception.

I know which of these I would prefer to have.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list