rbt wrote: >I've always thought of it like this... in C, we have to do something >like this when declaring a variable:
>int x = 0; >We had to specifically tell the language compiler that x is an integer. >In Python, all we have to do is: >x = 0 >The interpretor knows that x is an integer. We can also change the type >like this: >str(x) >float(x) >long(x) Just to clarify, str(x) does not change x, but x = str(x) does. Probably rbt knows this. I wonder how often this feature should be employed. In my Python programs, most variables keep the same type throughout. This makes a code easier for me to understand, and this constraint should facilitate translation of the code to a statically typed language (perhaps even a variant of Python) in the future, if necessary. The ability to grow a list with "append" is a very convenient feature of Python. The C++ vector is similar but stores elements of the same type, whereas a Python list or tuple can store elements of different types. -- http://mail.python.org/mailman/listinfo/python-list