strong/weak - dynamic/static [Was: Getting started]

Terry Reedy tjreedy at
Thu Sep 19 16:45:53 CEST 2002

"Jacek Generowicz" <jacek.generowicz at> wrote in message
news:tyf8z1y5cp5.fsf at
> A quick google search suggests that Bruce Eckel really claims that
> python is weakly typed (at least more weakly typed than C++).

To my commonsense idea of strong and weak, this is exactly backwards.

1. Python is not 'typed', at least not in the sense meant here.  Nor
is any other computer language ;-).  Languages (or programmers using
them) type 'things' within the language.

2. Unlike many other languages, Python does *not* type names.  Names
in Python are typeless - unless you want to claim that they take on a
type be virtue of being bound.  Python *does* type objects with
values, so you can also say that it types values.  On the other hand,
values in, for instance, C, can be regarded as typeless bit sequences
(which, at a hardware level, they are).

3. The typing that Python does do is *stronger* than that of C; no
type-changing casting allowed.  In some languages, you can, for
instance, treat a four-byte integer as an array of four characters,
but not in Python.  You can explicitly extract a byte with bit
shifting and making and use chr() to make a new object, but that is
different from treating the byte in place as a char.  [Discussion of
old and new classes and modification of instance.__class__ omitted.]

> Could someone provide a serious reference

I'll leave this for someone else.

>explaining or defining the concepts of ... dynamic and static typing.

Python objects are typed at creation.  Is that dynamic or static?  I'm
not sure the dichotomy applies to Python very well since it partly
depends on a distinction between declaration and definition that does
not exist in Python and a distinction between compile time and run
time that is somewhat different in Python.

Terry J. Reedy

More information about the Python-list mailing list