我在 python 2.7.3 中看到了这一点,包括 pylab 和 numpy。为什么是这样:
>>> x = pylab.arange(5)
>>> x = x + pylab.nan
>>> print x
[ nan nan nan nan nan]
与此不同:
>>> x = pylab.arange(5)
>>> x += pylab.nan
__main__:1: RuntimeWarning: invalid value encountered in add
>>> print x
[-9223372036854775808 -9223372036854775808 -9223372036854775808
-9223372036854775808 -9223372036854775808]
?