dynamic typing question
newsgroups at jhrothjr.com
Fri Dec 26 22:20:59 CET 2003
"Hung Jung Lu" <hungjunglu at yahoo.com> wrote in message
news:8ef9bea6.0312261227.56ade9a9 at posting.google.com...
> 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.
The OP said they would be using Test Driven Development. In TDD,
you write maybe a half dozen lines before running your test suite. If
it ran last time, and it didn't run this time, then you have maybe a
half dozen lines to check. Lots of people regard the 'undo' command
as a great debugger in this case.
Of course, if you write hundreds of lines before doing a compile,
then you will need all the help you can get.
> Hung Jung
More information about the Python-list