Hi, Is it bug if different NumPy types have different attributes? Based on prior discussion, 'complex', 'float' and 'int' are Python types and others are NumPy types. Consequently 'complex', 'float' and 'int' do not inherit from NumPy. However, an element from array created using dtype=numpy.float has the numpy.float64 type. So this is really a documentation issue than an implementation issue.
Also different NumPy types have different attributes, for example, 'float64' contains attributes (eg __coerce__) that are not present in 'float32' and 'float128' (these two have the same attributes). This can cause attribute errors in somewhat contrived examples that probably are unlikely to appear in practice because of the casting involved in array creation. The 'uint' types all seem to have the same attributes so do not have these issues. import numpy len(dir(float)) # 47 len(dir(numpy.float)) # 47 len(dir(numpy.float32)) # 131 len(dir(numpy.float64)) # 135 len(dir(numpy.float128)) # 131 len(dir(int)) # 54 len(dir(numpy.int)) # 54 len(dir(numpy.int0)) # 135 len(dir(numpy.int16)) # 132 len(dir(numpy.int32)) # 132 len(dir(numpy.int64)) # 135 len(dir(numpy.int8)) # 132 print (numpy.float64(1234).size) # 1 print (numpy.float(1234).size) ''' prints error: Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'float' object has no attribute 'size' ''' Regards Bruce _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion