not safe at all

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


I often have to do this:
x=getsomestringfromparameterfile()
x=string(x)

	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
Pascal.

Chris.

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

>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