[Numpy-discussion] can_cast with structured array output - bug?
Matthew Brett
matthew.brett at gmail.com
Mon Feb 13 20:20:52 EST 2012
Hi,
I've also just noticed this oddity:
In [17]: np.can_cast('c', 'u1')
Out[17]: False
OK so far, but...
In [18]: np.can_cast('c', [('f1', 'u1')])
Out[18]: True
In [19]: np.can_cast('c', [('f1', 'u1')], 'safe')
Out[19]: True
In [20]: np.can_cast(np.ones(10, dtype='c'), [('f1', 'u1')])
Out[20]: True
I think this must be a bug.
In the other direction, it makes more sense to me:
In [24]: np.can_cast([('f1', 'u1')], 'c')
Out[24]: False
In [25]: np.can_cast([('f1', 'u1')], [('f1', 'u1')])
Out[25]: True
Best,
Matthew
More information about the NumPy-Discussion
mailing list