Optional Static Typing

Rocco Moretti roccomoretti at hotpop.com
Thu Dec 23 14:37:53 EST 2004


John Roth wrote:

> "Rocco Moretti" <roccomoretti at hotpop.com> wrote 
 >
>> Looking at C, it's doubtful error prevention and program clarification 
>> was a serious objective in the static typing system. It's more 
>> reasonable to conclude that C is statically typed because it allows 
>> the compiler to more easily allocate 1 vs 2 vs 8 bytes for a 
>> particular variable, and to make sure the proper addition opcodes get 
>> put down.
> 
> The C language does not have strong typing in the sense
> that most people use the term today.

Strong != Static

As I understand it, strong typing means an object (variable) is what it 
is, and can't be changed to a different type without explicit conversion 
- weak typing being that an object can be any type, depending on which 
functions you use to look at it.

Static typing is that a variable has a specific type, and can't hold a 
variable of a different type. This is opposed to dynamic typing, where 
the type of an (object in a) variable is flexible and determined at run 
time.

Python - Strong, Dynamic
C - Weak, Static
Perl - Weak, Dynamic

This is how I understand it. Could be wrong - wouldn't be surprised if I 
was, as it's a rather confusing issue at times.

>> The question is, should Guido state "TDD is the one true way to 
>> program in Python.", or should concessions be made in the language 
>> design for those who don't "drink the TDD Kool-aide".
> 
> Neither one. I hope you didn't mean  that people
> who advocate TDD are suicidal fanatics, because
> that's exactly what "drink the  kool-aid" means.

The irony didn't travel well. All I meant is that in all the advocacy, 
it may get ignored that reasonable people might disagree about the value 
of TDD, that TDD is not a "be-all, end-all" for all people.

"Concessions" also probably wasn't the right choice of word, as it 
implies the TDD people are giving something up. My point was, if Python 
is not going to be solely targeted at TDD, facilities that make other 
ways of doing things easier are likely (should) be included, as long as 
they don't negatively affect how the majority of the people who use 
Python do things.

>>> So the conclusion here is that static typing is an attempt
>>> to make programming safe for people that shouldn't be
>>> programming in the first place.
>>
>> I rebut it thusly: "elitist bastard." <wink and a half>
> 
> Bullshit. Where did you get your certificate in mind  reading?

Sorry. I didn't mean to imply that *you* were an elitist bastard. I 
merely meant that someone who would dismiss something as for "people 
that shouldn't be doing X in the first place" is likely biased by 
snobbery. You were merely restating someone else's opinion, and if I 
accidentally accused you of also holding it, I'm sorry.

 From the rest of your post, it seems we pretty much agree on the key 
point - different people have different ways of doing things, none of 
which are necessarily "wrong" in and of themselves. Python tries to be 
open and inclusive towards all who want to program, without sacrificing 
power for it's core users.

Is there a group of people for whom static typing truly helps? I don't 
know. What I do know is that saying that you don't need static typing if 
you use TDD doesn't say anything about the helpfulness of static typing 
for those who don't use TDD. Whether the latter group is worth Python 
worrying about is a philosophical question on the future direction of 
Python best left to Guido.



More information about the Python-list mailing list