Could Python supplant Java?

brueckd at brueckd at
Tue Aug 20 21:53:45 CEST 2002

On Tue, 20 Aug 2002, David Abrahams wrote:

> > You are deceiving yourself if you think (at least a good portion of) the
> > burden of testing is not already on the developer. The difference between
> > static and dynamic typed languages is that with the dynamicly-typed
> > language you don't have the false sense of security. You should be
> > suspicious of all warm fuzzies derived from code that successfully
> > compiles. :-)
> In general I agree with that sentiment. However, there is at least one place
> where I've found compilation errors to be indispensable: when I'm
> refactoring code, I can make changes to an interface, and use the compiler
> to tell me about everything that needs to be adjusted correspondingly. That
> ability to lean on the compiler when reorganizing my code is something I've
> really missed when working on a large Python codebase.

Yeah, I see what you're saying, but to me that's the perfect example of 
what I'm talking about: once the refactored code compiles it's too 
tempting to think you're done. If the refactoring is nothing more than 
some name improvement, then maybe that's okay, but a lot of refactoring is 
much more invasive. I ran into refactoring trouble for this very reason in 
a large C program once where the changes were new names _plus_ a change in 
the storage size of a few structures. It came back and bit me because the 
code compiled but there in some places the code had made an assumption 
about the storage sizes. 

There are lots of other ways, especially in C++, where the refactored code
compiles even though it's not fully refactorted yet. In terms of
interfaces, I remember a problem with that once but not the specifics.
Something along the lines of a class that had two implementations of the
same method. I changed some of the arguments and tried to change all cases 
where it was called but missed one and the other implementation got called 
instead. It was a pretty easy bug to find, but the compiler never found 

Please note that I'm definitely not saying that having to manually check 
all uses where an API is used is the ideal way to refactor an API, simply 
that it is the only truly safe approach, and relying on the compiler is 
too likely to be a false indicator.


More information about the Python-list mailing list