[Numpy-discussion] Different attributes for NumPy types
Thu May 22 18:07:33 CDT 2008
On Thu, May 22, 2008 at 4:25 PM, Bruce Southey <firstname.lastname@example.org> wrote:
> On Thu, May 22, 2008 at 2:59 PM, Robert Kern <email@example.com> wrote:
>> On Thu, May 22, 2008 at 2:46 PM, Charles R Harris
>> <firstname.lastname@example.org> wrote:
>>> It also leads to various inconsistencies:
>>> In : float32(array([]))
>>> Out: array([[ 1.]], dtype=float32)
>>> In : float64(array([]))
>>> Out: 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.
> Otherwise, int, float and string type of arguments would be okay under
> the assumption that people would like variable precision scalars.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion