not safe at all

Terry Reedy tjreedy at home.com
Fri Jul 13 15:50:04 EDT 2001


> I believe it, but it doesn't demonstrate a thing about type safety.
> You've just discovered dynamic typing.

This might be better called dynamic naming or dynamic binding.  'Dynaming
typing' is confusing, as evidenced here, because of its two possible
interpretations.

1. Types are assigned at runtime (because they are created at runtime).
True.
2. Types are changeable at runtime.  Untrue, unless you count changing an
instance's base class (a recent addition to the language.   In this sense,
Python object types are fixed or static.  They are not like C unions.

>  You see, your implied view of
> typing seems to come from a statically typed language, where every
> *variable* has a type of its own.
>
> In Python, types are associated with *objects*, not with *variables*.
> IOW, all variables are of the same type: reference-to-object.

One of the keys to understanding Python.

Terry J. Reedy






More information about the Python-list mailing list