[Numpy-discussion] Different attributes for NumPy types

Travis E. Oliphant oliphant at enthought.com
Thu May 22 20:38:10 EDT 2008


Charles R Harris wrote:
>
>
> On Thu, May 22, 2008 at 5:07 PM, Robert Kern <robert.kern at gmail.com 
> <mailto:robert.kern at gmail.com>> wrote:
>
>     On Thu, May 22, 2008 at 4:25 PM, Bruce Southey <bsouthey at gmail.com
>     <mailto:bsouthey at gmail.com>> wrote:
>     > On Thu, May 22, 2008 at 2:59 PM, Robert Kern
>     <robert.kern at gmail.com <mailto:robert.kern at gmail.com>> wrote:
>     >> On Thu, May 22, 2008 at 2:46 PM, Charles R Harris
>     >> <charlesr.harris at gmail.com <mailto:charlesr.harris at gmail.com>>
>     wrote:
>     >>> 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
>     >>
>     >> Okay, so don't do that. Always use x.astype(dtype) or
>     asarray(x, dtype).
>     >
>     > So, should these return an error if the argument is an ndarray
>     object,
>     > a list or similar?
>
>     I think it was originally put in as a feature, but given the
>     inconsistency and the long-standing alternatives, I would deprecate
>     its use for converting array dtypes. But that's just my opinion.
>
>
> I agree. Having too many ways to do things just makes for  headaches. 
> Should we schedule in a deprecation for anything other than scalars 
> and strings.

I don't have a strong opinion either way.

-Travis





More information about the NumPy-Discussion mailing list