Who's minister of propaganda this week?

Paul Prescod paulp at ActiveState.com
Sun Mar 18 13:14:18 EST 2001


Michael Chermside wrote:
> 
>...
> 
> But I'm quite surprised that you think you pay a 10% penalty
> for going through contortions to adhere to static typechecking.
> You see... in my own experience, I hardly ever want to violate
> it. I generally design type hierarchys and use objects in places
> where I expect an object of that type or of a direct ancestor.

One issue is that you often do not have control over the design of type
hierarchies. You need to glue together two or more large frameworks and
you have no opportunity to set up interfaces etc. as you want.

Another issue is that there are certain kinds of advanced programming
that are are exceedingly difficult in statically typed languages. For
instance let's say you are implementing some kind of object request
broker and you are handed a new interface at runtime. In Java, the way
you handle new interfaces is basically to generate Java "wrapper code".
For instance "JIDL". If you didn't ALREADY have JIDL, you would have to
count the cost of developing it as part of the cost of impleenting CORBA
in Java.

In Python, you don't need anything like that. You could either ignore
the interface declaration or you could write code that reads and
enforces it at runtime. Or you could generate wrapper code as you do in
Java. You have a choice of three different levels of safety versus
performance versus effort. And even if you do decide to generate the
wrapper code, I claim it would be a simpler task than generating
strongly-typed Java wrappers.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.activestate.com/pythoncookbook




More information about the Python-list mailing list