考虑以下:
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 2.0
>>> print x < 2.0
False
>>>
>>> x = 2.2
>>> x -= 0.2
>>> print x < 2.0
False
>>>
>>> x = 2.4
>>> x -= 0.2
>>> x -= 0.2
>>> print x < 2.0
True
>>> print x
2.0
当 x 从 2.4 减少到 2.0 时,为什么最后第二条语句打印 True ?我错过了什么?