[Types-sig] Why I don't like static types in Python

Justus Pendleton Justus Pendleton <justus@acm.org>
Fri, 27 Nov 1998 12:08:52 -0500


On Fri, Nov 27, 1998 at 10:21:40AM +0100, Fredrik Lundh wrote:
> Hmm.  Based on what's said on http://www.python.org/sigs/types-sig/
> I thought this was a working group that was going to refine and possibly
> also work on implementing the various typing issues that were discussed
> by many highly experienced Python developers in several sessions at the
> recent Python conference, not a general discussion group.  Have you read
> that page and come to another conclusion?

Hmmm...the page I read said

"This list has been created for discussions on issues related to Python's
type system."

When I click on the link for "Static Typing Proposals" it says "coming soon".
When I click on the link for "Interface definitions" it says "coming soon".

My response was based on reading Roger Masse's current position paper, "Add
Later Static Types for Python" and his summary of the developer day session
on the same topic.

As far as I can tell this is a working group for "discussions on issues
related to Python's type system" and I think that before anyone starts
discussing how to implement static types it might be good if it were clear
what the goal of such a system might be.  I couldn't find a clear description
of that goal in anything that I read.  My post was an attempt to clear up
what that goal might be.

Perhaps some of these "many highly experienced Python developers" could
answer my questions without resorting to the Authority or Social Proof
methods of persuasion?  I don't care how experienced the doctor is, I usual
prefer an explanation of why he needs to conduct a rectal examination....

> But in a world where all larger programs are dynamically configured, global
> analysis is a relatively worthless concept.

Out of curiosity (since I don't know) does this mean that run-time and/or
dynamic recompilation are equally fruitless avenues of inquiry?

> We're not talking 10% speed increase. We're talking near-C speed.
> And from another perspective, much lower development costs for
> equivalent code.

I admit that I am skeptical of claims of near-C speed :-)  Java is statically
typed and isn't really "near-C speed".  Python claims to be a higher level
language than Java so I have difficulty believing it will succeed where Java
fails....especially since Python's static typing would be voluntary which
makes me believe that it wouldn't be as effective as Java's mandatory static
typing.

Maybe if someone had a working example of a statically typed, dynamic, higher
level, object oriented language that has near-C speed I would be more easily
convinced..?

I have a question (since I don't know), if the static typing is voluntary
then does that mean that nothing in the core python library could use static
typing?

> >Roger Masse writes that static typing provides an 'improved level of type
> >safety and program correctness' but I'm not aware of any empirical evidence
> >of this. 
> 
> How large is your largest Python application?  10k lines?  20k lines?
> 50k lines?  How many people worked on your development team?
> How many design iterations have you had this far?

Hmmm...this doesn't really answer my concern about the lack of empirical
evidence of the usefulness of static typing.  Anecdotal evidence simply isn't
enough as far as I'm concerned.  For years there was anecdotal evidence that
client/server systems were the brilliant wave of the future, but in the
November/December issue of IEEE Software Diomidis Spinelli argues
convincingly that client/server systems have failed.

> >Maybe if someone could give me an example of a real world problem
> >they couldn't solve in Python because it lacked these features it would
> >be easier for me to understand the need we are trying to address here.
> 
> http://www.python.org/sigs/types-sig/

I am subscribed to the list and have read every message that has ever been
posted to the list (all 54 of them :)

Virtually all of them are about interfaces.  Virtually all of them are about
implementation.  If you could actually point out which one of those 54
messages contain "an example of a real world problem they couldn't solve in
Python because it lacked these features it would be easier for me to
understand the need we are trying to address here."

> Note that there are *three* different issues at hand.  Static typing
> is just one of them.

I realize that and my post mixed together the issues somewhat :-(, I apologize
for that.
-- 
Justus Pendleton <justus@acm.org>