Open
Description
(From #10135.)
In Numpy, empty arrays have the default data type numpy.float64
.
print(numpy.array([]).dtype) # float64
I'm questioning whether this is the right choice.
In principle, the default dtype choice for empty arrays is arbitrary since there is no data to work with. One good reason to choose a small data type is that operations with empty arrays should not needlessly augment the dtype. The current setting leads to rather surprising dtype changes like
print(numpy.concatenate([[0], []])) # [0.0], not [0]
This would not have happened with, e.g., numpy.array([]).dtype == numpy.int8
.