こんにちは。
Python 2.x で、 numpy.float64
(scipy.sqrt
などの返り値も)などの値と unicode literal とを比較すると、 UnicodeWarning
となるようです。これに対して math.sqrt
の返り値は float
なので大丈夫です。
$ python --version
Python 2.7.11
$ python -c "from __future__ import unicode_literals;import math;x=math.sqrt(1);print x.__class__, x=='one'"
<type 'float'> False
$ python -c "from __future__ import unicode_literals;import scipy;x=scipy.sqrt(1);print x.__class__, x=='one'"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
<type 'numpy.float64'> False