[Numpy-discussion] np.void from 0d array + subclassing
Robert Kern
robert.kern@gmail....
Thu Dec 17 17:46:07 CST 2009
On Thu, Dec 17, 2009 at 17:41, Pierre GM <pgmdevlist@gmail.com> wrote:
> On Dec 17, 2009, at 6:35 PM, Robert Kern wrote:
>> On Thu, Dec 17, 2009 at 16:11, Pierre GM <pgmdevlist@gmail.com> wrote:
>>> Here's the catch: IIUC, each individual element of a nD structured array is a void, provided the element can be accessed, ie that n>0. A 0D array cannot be indexed, so I don't know how capture the object below. The sad trick I found was to do a .reshape(1)[0], but that looks really overkill...
>>
>> a[()]
>
> Well, that's slick and really neat !!! Typically Robert K's... Thanks a lot !!!
> And would you have anything as cool for the reverse operation (from np.void to 0d array) ?
a = np.array(v)
--
Robert Kern
"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
mailing list