Python for large projects

Jacek Generowicz jacek.generowicz at
Wed Mar 24 17:29:59 CET 2004

Stefan Axelsson <crap1234 at> writes:

> Jacek Generowicz wrote:


> > - Static typing systems refuse to compile programs which contain type
> >   errors.
> > - Test suites point out where your program deviates from expected
> >   behaviour.
> You're really not comparing like with like here.

I am comparing two often cited means to help writing more correct

> While the first statement is true on the face of it. The second is
> also true on the face of it, but probably not what you meant. It's
> that if the unit tests have been designed to find deviations from
> the 'expected' behaviour they will. Whether the 'expected' behaviour
> was actually the 'specified' behaviour is another question entirely.
> Programmers/designers misunderstanding the specification is all to
> common an occurrence.

No argument there.  However, static type systems' misunderstanding of
the problem is an even more common occurence ... basically because
static type systems don't even attempt to understand the problem. They
interfere with the developer regardless.

> So, in the case of unit testing the specification has to be
> interpreted. And there's nothing to stop the programmer to take
> advantage of a static typing system to make the same interpretation,
> aka 'typeful programming'. There's little difference between thinking
> up a test case and a type during the design. (And you have to do both
> anyway).

The sum of the capabilities of your language strike me as more
flexible that the just the typesystem, so I would venture that test
suites offer you more fine grained control when specifying the
required behaviour of your program. But I'd love to be enlightened, if
I'm missing your point.

> It should be noted that I speak of Hindley Milner type typesystems.
> I.e. that do type inference and can handle polymorphism in data
> structures as in e.g. Haskell.

(In which case you should note that I largely absolve those type
systems from my (specific to this thread) criticisms, upthread.)

> I've found that a problem with making this restriction is that someone
> always draws up 'C' or 'C++' as an example of 'static typing' and by
> all means, if that's what you're comparing against, then allmost
> anything would be an improvement.

No argument there.

> However they're not state of the art and any example drawn from the
> that world is not an argument against static typing per se.

Would you consider Java's type system to be "state of the art"?  I
ask, because all too often I am confronted with things like the
following (this one actually comes from elswthere in this very

gabor <gabor at> writes:

gabor> i wanted to use python for a project in our company... we wanted to
gabor> build a fairly big system/program.
gabor> but when i recommended python, i got a question like:
gabor> (previously all the programs were written in java) "if one of
gabor> our programmers changes a method in a class/interface, we
gabor> immediately will know about it, because the next
gabor> program-rebuild will simply fail. but if we would use python,
gabor> we wouldn't find it out".

... which suggests to me that there are a lot of people out there
(most of whom have probably never heard of Hindley Milner type
systems, or any languages endowed with them) firmly believe that
static type systems in general (and Java, C++ in particular) help them
write more correct code. This is a fallacy and their noses should be
rubbed in it.

> > What is more important to you and/or your clients ?  Ask yourself the
> > following questions:
> > - Do your clients give a hoot about whether or not a program is
> >   considered to be type-correct by the type system of programming
> >   language X ?
> > - Do your clients care whether your program does what it is supposed
> > to
> >   do ?
> As I said. Given typeful programming the first statement is more or
> less the same as the second. 

Forgive me if I am wrong ... but typeful programming is more of a
programming style rather than a property of a (static) type system, is
it not? I realize that Haskell encourages typeful programming by its
very nature, but that doesn't make typeful programming an property of
the type system.

(I am not sufficiently familiar with typeful programming or Haskell,
in a real-life situation, so do correct me if you think I am wrong.)

You could attempt to improve the correctness of your software by
writing test suites, or you could do it by programming "typefully";
either way you have to invest some effort. What I object to, is the
suggestions that static type systems somehow provide some significant
safety for free. What I object to even more, is the suggestion that
static type systems are _necessary_ to prevent any development process
from turning into an unmitigated disaster. Well, let's not get too
excited ... what I object to are suggestions that Java is more
suitable for programming projects _because_ it has a static type

> And the second doesn't follow from your statements above,

In what sense should it "follow" ?  It's an independent
question. (Though it does appear in a suggestive context ...)

> there's a crucial difference.

Between what and what ?

More information about the Python-list mailing list