Python Strings

Erik Max Francis max at alcyone.com
Tue Sep 5 13:28:51 EDT 2000


Jonadab the Unsightly One wrote:

> The trouble with that kind of variable is that it forces
> strong typing, which is bad for those of us who prefer
> type-checking to be on another continent while we're busy
> trying to write code.  I have yet to learn the language
> (though I haven't learned Python yet; gearing up to do that)
> which is quite as loosely typed as I want.

Python is actually quite strongly typed, it just doesn't require
declarations of the types of variables to be used, and they can be
changed.

    a = 1               # a refers to an int
    a = '1'             # a now refers to a string
    a = open('/a/file') # a now refers to a file object

> Inform is the
> closest, but you can't always tell the difference between
> all types at runtime, which is troublesome occasionally.

That's sort of the flip side of weakly-typed languages; if they're
weakly typed then you have to play games when you _do_ need to know the
type of an object.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Whoever contends with the great sheds his own blood.
\__/ Sa'di
    Alcyone Systems' CatCam / http://www.catcam.com/
 What do your pets do all day while you're at work?  Find out.



More information about the Python-list mailing list