带下划线的 NumPy 类型:`int_`、`float_` 等 [英] NumPy types with underscore: `int_`, `float_`, etc
问题描述
int_
、float_
等中下划线后缀的意义是什么?
What is the significance of the underscore suffixing in int_
, float_
, etc.?
推荐答案
来自 Numpy 指南的第 21 页 作者:TE Oliphant:
From page 21 of Guide to Numpy by TE Oliphant:
数据类型的名称与标准 Python 对象发生冲突名称后跟一个尾随下划线,''.这些数据类型是如此命名是因为它们使用相同的基础精度为对应的 Python 数据类型.
Names for the data types that would clash with standard Python object names are followed by a trailing underscore, ’ ’. These data types are so named because they use the same underlying precision as the corresponding Python data types.
...
数组类型bool_
、int_
、complex_
、float_
、object_
、unicode_
和 str_
是增强标量.他们很类似于标准的 Python 类型(不带尾随下划线)和从它们继承(除了 bool_
和object_
).它们可以用来代替标准 Python 类型想要的.每当数据类型是需要,作为参数,标准Python 类型也被识别.
The array types
bool_
,int_
,complex_
,float_
,object_
,unicode_
, andstr_
are enhanced-scalars. They are very similar to the standard Python types (without the trailing underscore) and inherit from them (except forbool_
andobject_
). They can be used in place of the standard Python types whenever desired. Whenever a data type is required, as an argument, the standard Python types are recognized as well.
这篇关于带下划线的 NumPy 类型:`int_`、`float_` 等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!