On Thu, Dec 17, 2009 at 16:11, Pierre GM <pgmdevl...@gmail.com> wrote: > On Dec 17, 2009, at 10:16 AM, Francesc Alted wrote: >> A Thursday 17 December 2009 15:16:29 Pierre GM escrigué: >>> All, >>> * 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)[0], but that looks really overkill...
a[()] -- 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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion