Python Strings

Quinn Dunkan quinn at cruzeiro.ugcs.caltech.edu
Wed Sep 6 14:44:47 EDT 2000


On Wed, 06 Sep 2000 08:00:40 -0700, Keith Ray <k_j_r_a_y at ix.netcom.com> wrote:
>What most people mean by "strongly-typed" or "staticly typed" is "there 
>is compile-time checking of variable types" (and parameter-types, and 
>function-return-types and expressions being assigned or passed into 
>variables/parameters/etc.).
>
>What most people mean by "weakly-typed" or "dynamically typed" is "there 
>is only run-time checking of variable types" (and parameter-types, and 
>function-return-types and expressions being assigned or passed into 
>variables/parameters/etc.).
>
>C is a language that is staticly typed -- but the parameter types for 
>non-prototyped function are not checked by the compiler, making C one of 
>the most dangerous language in which to be a sloppy programmer.

Well, I've never taken a CS class, but my impression was that:

strongly typed - no typecasts, values' types never change
weakly typed - typecasts (does this include automatic conversion like perl?)

statically typed - function signatures and variable bindings must be known at
    compile time
dynamically typed - types are muddled out at runtime

untyped - there is only one type (strings for tcl, hex for assembly, ...)

So python is strongly dynamically typed.
C is weakly statically typed.
haskell is strongly statically typed.

In fact, C is the only language I know of that is weakly typed... is this
"correct" usage?  It makes sense to me... but I posted this because I'm sure
someone out there can clear this up for me.

>C++ and Java are staticly typed -- you declare a type for a variable. If 
>you try to assign the wrong type to it, the compiler complains at 
>compile-time. If you try to pass an array into a function that is 
>expecting a floating-point-scalar, then the compiler will give you an 
>error at compile time.

I would consider the language's reference/binding semantics to be a seperate
issue from typefulness.  In fact, C and perl (and java?) are the only
languages I know of that always use explicit references/pointers.



More information about the Python-list mailing list