strong/weak typing and pointers

Grant Edwards grante at
Thu Oct 28 21:07:45 CEST 2004

On 2004-10-28, Diez B. Roggisch <deetsNOSPAM at> wrote:

> It seems that you mistake strong/weak typing with
> static/dynamic typing - a completely different beast.
> Python is in fact strong typed - in opposition to php or perl or even C,
> this won't work:
> a = "1" + 2
> as "1" is a string and 2 an integer.

"1" is a pointer to a char.

> And even though C is statically typed, it won't complain

That's because <pointer> + <integer> has a well-defined meaning
in C -- just like <float> + <integer> does in Python (and in C).

> - you just end up with an unexpected result.

Only people who don't know how C pointer arithmatic works will
get unexpected results.  [That's probably a shockingly high
percentage of C programmers.]

Grant Edwards                   grante             Yow!  I brought my BOWLING
                                  at               BALL -- and some DRUGS!!

More information about the Python-list mailing list