Is Python type safe?

Greg Ewing (using wmwd2zz02 at
Wed Mar 17 02:10:42 CET 2004

Roy Smith wrote:
> Neither C++ nor Python will let you add the integer 3 to the string 
> "four",

Actually, C++ (and C) will:

cosc353% cat foo.c
#include <stdio.h>
main() {
   const char *s = "four" + 3;
   printf("%s\n", s);
cosc353% g++ foo.c -o foo
cosc353% foo

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list