Is Python type safe?

Greg Ewing (using news.cis.dfn.de) wmwd2zz02 at sneakemail.com
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
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