Static Typing in Python

Jacek Generowicz jacek.generowicz at cern.ch
Mon Mar 15 14:10:45 EST 2004


Ludovic Aubry <no_ludal_spam at logilab.com> writes:

> On Mon, 15 Mar 2004 14:41:10 +0100, Jacek Generowicz wrote:
> 
> > Python is strongly typed because:
> > 
> > - lots of type checking is done
> > - few implicit type conversions are done.
> > - No operations which are inappropriate to the object(s) in question
> >   are allowed.
> While I agree with the above...
> 
> I think your arguments in the following are mostly wrong:

I did say (somewhere) that strong and weak typing is a pretty
wish-washy concept ... and I'm not going to engage in discussions of
just how weakly typed C is and why. I agree, there are plenty of ways
in which you could pick holes in my examples. I'm sorry, I don't find
pursuing this train of thought very interesting.

> > Try as you will, Python would not allow you to do any of these things,
> > because it is _strongly typed_ with respect to these operations on these
> > types.
> Python will allow you to multiply string with integers for example ;)

Yes, and in that respect it is weakly typed. 

ML, for example wouldn't even allow you to add a float to an integer,
without explicit instructions stating what it is that you mean, which
Python would do for you without hesitation, so in that respect Python
is more weakly typed than ML.

PERL would allow you to add "3" to 3, Python would not. In that
respect Python is more strongly typed than PERL.

(I neither know nor care whether the answer PERL gives you is 6 or 33 :-)



More information about the Python-list mailing list