Is Python type safe?

Mathias Waack M.Waack at gmx.de
Tue Mar 16 21:53:24 CET 2004


Roy Smith wrote:
> Neither C++ nor Python will let you add the integer 3 to the string
> "four", but use different mechanisms to prevent it.  Oddly enough,
> Java (in a perl-like, but admittedly convenient, stab at automagic
> polymorphism) will let you add them.  

Thats not true, Java doesn't let you add an integer to a string. It
only looks like that because of implicit type conversion. BTW the
same holds for C++ if you are using a string type which allows this
conversion. 

Mathias



More information about the Python-list mailing list