Static Typing in Python

Peter Hickman peter at semantico.com
Tue Mar 16 10:18:05 CET 2004


Premshree Pillai wrote:
>  --- Peter Hickman <peter at semantico.com> wrote: >
> Premshree Pillai wrote:
>>>Like in C, C++, etc, Python too is
>>>strongly typed, i.e., variables are necessarily
>>
>>bound
>>
>>>to a particular type.

[deletia]

> The above returns a TypeError in Python, but not in
> PHP, which is weakly typed.
> 
> Get it?

The only two (or perhaps one and a half) languages you used as reference 
were C and C++. Which you said 'Like in C, C++, etc, Python too is 
strongly typed'. What has PHP got to do with it? How does PHP's typing 
have anything to do with Python's?

Typing in C and C++ is different to Python.

int c = 0;
c = "fred";

No can do in C and C++.

c = 0
c = "fred"

No problem in Python.

So just how is Python strongly typed 'like in C, C++, etc'?



More information about the Python-list mailing list