Adding static typing to Python

Justin Sheehy justin at iago.org
Thu Feb 21 16:56:10 CET 2002


gbreed at cix.compulink.co.uk writes:

> It looks like "strong typing" doesn't have a universally agreed
> definition, so I suppose the best thing is to avoid the term.

Sounds good to me.  I suspect that everything necessary can be
expressed with combinations of "static", "dynamic", and "weak".
("weak" can be used along with "static" to describe languages like C)

> Out of general interest, does anybody know of a dictionary I *can* rely on 
> for these kind of definitions?

Sadly, no.

> If the type was declared only for the initial assignment, for example
>
> def cons(element, stuff: tuple):
>   stuff = list(stuff)
>   stuff.append(element)
>   return tuple(stuff)
>
> would that still be static typing?

Most languages with static typing only require you to declare a given
name's type once.  However, they also tend to enforce that you not
then rebind the name to a value of another type.  So, I'm not sure how
I would describe the behavior shown in the example.  That doesn't mean
that it doesn't make sense, but that I don't know how to classify it.

> Yes, and the example was of an identifier being bound to a different type. 
> I never said any objects were changing type. 

My apologies.  I misread your description and went straight to the example.

-Justin

 





More information about the Python-list mailing list