Python vs .Net

Peter Hansen peter at engcorp.com
Mon Jan 6 14:07:08 CET 2003


Greg Brunet wrote:
> 
> - VB.NET (as well as C##) are/can be very strongly statically typed -
> even more so than VB6.  I'm still trying to determine if I like a
> strongly _dynamically_ typed language like Python.  I'm having a hard
> time understanding why it's not better to know at compile time that
> ['foo' + 5] is an exception.  If I have to wait until runtime, then I
> would think that I need to be writing LOTS more error checking code at
> all my function entry points, whereas with strong static typing, I can
> catch all this at compile time.  

While the specific example you quote, where two statically defined
*constants* are being added, *could* be caught by the compiler, 
it's pretty rare to be doing that anyway.  More likely you would
be doing something like ['foo' + bar] where bar is bound to the 5.
That would not be catchable until runtime, by definition.

You are wrong about needing to write LOTS more error checking code
at your function entry points, though.  What you need to do is
write LOTS of unit tests, and acceptance tests, to catch these
problems before you release.  But you do that anyway (right? ;-) )
since the minimal checking your VB.NET compiler does cannot possibly 
catch the majority of problems in your code...

-Peter




More information about the Python-list mailing list