[Numpy-discussion] Different attributes for NumPy types

Charles R Harris charlesr.harris at gmail.com
Thu May 22 15:46:45 EDT 2008


On Thu, May 22, 2008 at 1:32 PM, Bruce Southey <bsouthey at gmail.com> wrote:

> Hi,
> Thanks very much for the confirmation.
>
> Bruce
>
> On Thu, May 22, 2008 at 2:09 PM, Robert Kern <robert.kern at gmail.com>
> wrote:
> > On Thu, May 22, 2008 at 10:24 AM, Travis E. Oliphant
> > <oliphant at enthought.com> wrote:
> >> Bruce Southey wrote:
> >>> Hi,
> >>> Is it bug if different NumPy types have different attributes?
> >>>
> >> I don't think so, other than perhaps we should not have the Python types
> >> in the numpy namespace.
> >>
> >> numpy.float is just __builtin__.float   which is a Python type not a
> >> NumPy data-type object.
> >>
> >> numpy.float64 inherits from numpy.float however.
> >
> > And I believe this is the cause of the difference between the
> > attributes of numpy.float32/numpy.float128 and numpy.float64. Same
> > deal with int0 and int64 on your presumably 64-bit platform.
> >


It also leads to various inconsistencies:

In [1]: float32(array([[1]]))
Out[1]: array([[ 1.]], dtype=float32)

In [2]: float64(array([[1]]))
Out[2]: 1.0

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080522/a909a1ee/attachment.html>


More information about the NumPy-Discussion mailing list