4
numpy
數值類型是怎麼來的basestring
的子類型?numpy:int是一個基礎字符串?
for nptype in [np.int32, np.int64, np.integer, np.float]:
for stype in [str, basestring, unicode]:
print nptype, stype, np.issubdtype(nptype,stype)
<type 'numpy.int32'> <type 'str'> False
<type 'numpy.int32'> <type 'basestring'> True
<type 'numpy.int32'> <type 'unicode'> False
<type 'numpy.int64'> <type 'str'> False
<type 'numpy.int64'> <type 'basestring'> True
<type 'numpy.int64'> <type 'unicode'> False
<type 'numpy.integer'> <type 'str'> False
<type 'numpy.integer'> <type 'basestring'> True
<type 'numpy.integer'> <type 'unicode'> False
<type 'float'> <type 'str'> False
<type 'float'> <type 'basestring'> True
<type 'float'> <type 'unicode'> False