Is Python type safe?

Greg Ewing (using news.cis.dfn.de) wmwd2zz02 at sneakemail.com
Tue Mar 16 20:10:42 EST 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
r

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list