Many functions accept a dtype argument for type conversions. That argument can be an instance of numpy.dtype or anything that can be converted to those by the numpy.dtype constructor. That includes:
Currently, those arguments are typed inconsistently as Any, object, or DtypeType which covers only the first case. The fix for this should probably cover:
Giving all those arguments a DtypeSpec type
change the numpy.dtype signature to accept a DtypeSpec argument
Make DtypeSpec as close as possible to the description above.
For item 3, it's not necessary to cover everything that's possible but it should cover the most frequent uses.
Many functions accept a
dtype
argument for type conversions. That argument can be an instance ofnumpy.dtype
or anything that can be converted to those by thenumpy.dtype
constructor. That includes:int
,float
,str
,MyCustomClass
)[('f1', np.uint), ('f2', np.int32)]
int32
), or dtype descriptions like<i2
.More details available at http://docs.scipy.org/doc/numpy/reference/generated/numpy.dtype.html
Currently, those arguments are typed inconsistently as Any, object, or
DtypeType
which covers only the first case. The fix for this should probably cover:numpy.dtype
signature to accept aDtypeSpec argument
DtypeSpec
as close as possible to the description above.For item 3, it's not necessary to cover everything that's possible but it should cover the most frequent uses.