not safe at all

Christopher L Spencer clspence at
Sat Jul 14 05:12:05 EDT 2001

I often have to do this:

	I consider this to be an advantage of Python.  If you are not
skilled enough to use this feature, then I'd suggest you stick with


On Fri, 13 Jul 2001 07:32:28 GMT, Dennis Roark <denro at>

>For amusement, run this little script which demonstrates a
>near ultimate in the lack of type safety in the language.
>(Perhaps there is a bit of type safety in that you can't do
>this:  4 + "one") But look at what you can do in the
>following script:
>x = 3
>x = x + 2
>print "x =", x
>x = "now I'm a string"
>print x
>x = [ 5, x ]
>print "and now a list:", x
>If you don't believe it, run it.  Should any language allow
>x to be such a chameleon, to where it can even be a
>different type on two sides of an assignment?	
>Dennis Roark
>Dept. of Computer Science
>University of Sioux Falls
>Starting Points:

More information about the Python-list mailing list