[Numpy-discussion] Automatic custom dtype

Charles R Harris charlesr.harris@gmail....
Fri Jun 21 08:49:42 CDT 2013


On Fri, Jun 21, 2013 at 7:09 AM, Richard Hattersley
<rhattersley@gmail.com>wrote:

> Hi all,
>
> In my continuing adventures in the Land of Custom Dtypes I've come
> across some rather disappointing behaviour in 1.7 & 1.8.
>
> I've defined my own class `Time360`, and a corresponding dtype
> `time360` which references Time360 as its scalar type.
>
> Now with 1.6.2 I can do:
> >>> t = Time360(2013, 6, 29)
> >>> np.array([t]).dtype
> dtype('Time360')
>
> And since all the instances supplied to the function were instances of
> the scalar type for my dtype, numpy automatically created an array
> using my dtype. Happy days!
>
> But in 1.7 and 1.8 I get:
> >>> np.array([t]).dtype
> dtype('O')
>
> So now I just get a plain old object array. Boo! Hiss!
>
> Is this expected? Desirable? An unwanted regression?
>
>
Bit short on detail here ;) How did you create/register the dtype?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130621/86957f4a/attachment.html 


More information about the NumPy-Discussion mailing list