Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NumPy types with underscore: `int_`, `float_`, etc

What is the significance of the underscore suffixing in int_, float_, etc.?

like image 349
pic11 Avatar asked Jun 01 '11 17:06

pic11


1 Answers

From page 21 of Guide to Numpy by TE Oliphant:

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.

. . .

The array types bool_, int_, complex_, float_, object_, unicode_, and str_ are enhanced-scalars. They are very similar to the standard Python types (without the trailing underscore) and inherit from them (except for bool_ and object_). 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.

like image 183
Steven Rumbalski Avatar answered Oct 16 '22 22:10

Steven Rumbalski