dynamic typing question

Robin Munn rmunn at pobox.com
Fri Dec 26 17:58:08 EST 2003


Hung Jung Lu <hungjunglu at yahoo.com> wrote:
> claird at lairds.com (Cameron Laird) wrote in message news:<vuojf5kc3v1lca at corp.supernews.com>...
>> 1.  Why, in your mind or your teammate's,   
>>     is dynamic typing a "lack"?  What, pre-       
>>     cisely, is the benefit of static typing?       
>>     There are a number of legitimate 
>>     answers.  It occurs to me that, without 
>>     precision on which interest you, we 
>>     might be missing an opportunity to 
>>     clarify "The Python Way" significantly.
>
> One static typing advantage I've run into:
>
> When you change the name of a variable in a class, and re-compile the
> program, the compiler shows you ALL places where compilation fails.
> These could be hundreds of places in dozens of files. In dynamically
> typed language like Python, you have to rely on text search, which
> often yields many false positives, especially for common/overloaded
> names like .count, .name, .type, etc. In statically-typed languages,
> making name changes is not very painful, since the compiler will tell
> you where exactly you need to follow up with the changes. In
> dynamically typed language, you will have to manually write unit test
> codes to ensure name consistency.
>
> I am sure Python people have come up with strategies to deal with this
> problem. That's what I'd like to hear. (Unit test is one route.) But
> this is one place where I've found statically-typed compilers useful.
> I mean, I have seen this discussion many times, but most responses
> from Python users have not been realistic (often simply shrugging off
> the problem and saying something like "compilers don't detect all the
> bugs, blah blah blah".) I would like to hear more real-life experience
> rather than academic conjectures.

That sounds like exactly the sort of problem that the Bicycle Repair Man
project (http://sourceforge.net/projects/bicyclerepair/) is intended to
solve. It's a refactoring browser for Python code.

Caveat: I've not actually used Bicycle Repair Man myself, so I don't
know if there are any hidden gotchas. But I've heard very good things
about it from other people.

The name "Bicycle Repair Man", BTW, is a reference to a Monty Python
skit involving a superhero whose special power was repairing bicycles.

-- 
Robin Munn
rmunn at pobox.com




More information about the Python-list mailing list