Python没有和C/C++一样的类型,这似乎是你的问题。
试试这个:
>>> i = 123
>>> type(i)
<type 'int'>
>>> type(i) is int
True
>>> i = 123456789L
>>> type(i)
<type 'long'>
>>> type(i) is long
True
>>> i = 123.456
>>> type(i)
<type 'float'>
>>> type(i) is float
True
不过,在Python3.0中,int和long之间的区别消失了。