not safe at all

Dennis Roark denro at earthlink.net
Fri Jul 13 03:32:28 EDT 2001


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:  http://home.earthlink.net/~denro
---------------------------------



More information about the Python-list mailing list