[Numpy-discussion] np.void from 0d array + subclassing
Thu Dec 17 17:35:26 CST 2009
On Thu, Dec 17, 2009 at 16:11, Pierre GM <email@example.com> wrote:
> On Dec 17, 2009, at 10:16 AM, Francesc Alted wrote:
>> A Thursday 17 December 2009 15:16:29 Pierre GM escrigué:
>>> * What is the most efficient way to get a np.void object from a 0d
>>> structured ndarray ?
>> I normally use `PyArray_GETITEM` C macro for general n-d structured arrays. I
>> suppose that this will work with 0-d arrays too.
> Francesc, you're overestimating my knowledge of C... Can we stick to the Python implementation ?
> 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), but that looks really overkill...
"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