Re: [Numpy-discussion] can_cast with structured array output - bug?

2012-02-14 Thread Matthew Brett
Hi, On Mon, Feb 13, 2012 at 7:02 PM, Mark Wiebe mwwi...@gmail.com wrote: I took a look into the code to see what is causing this, and the reason is that nothing has ever been implemented to deal with the fields. This means it falls back to treating all struct dtypes as if they were a plain

Re: [Numpy-discussion] can_cast with structured array output - bug?

2012-02-14 Thread Mark Wiebe
On Tue, Feb 14, 2012 at 7:19 PM, Matthew Brett matthew.br...@gmail.comwrote: Hi, On Mon, Feb 13, 2012 at 7:02 PM, Mark Wiebe mwwi...@gmail.com wrote: I took a look into the code to see what is causing this, and the reason is that nothing has ever been implemented to deal with the fields.

[Numpy-discussion] can_cast with structured array output - bug?

2012-02-13 Thread Matthew Brett
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')])

Re: [Numpy-discussion] can_cast with structured array output - bug?

2012-02-13 Thread Mark Wiebe
I took a look into the code to see what is causing this, and the reason is that nothing has ever been implemented to deal with the fields. This means it falls back to treating all struct dtypes as if they were a plain void dtype, which allows anything to be cast to it. While I was redoing the