On Mon, Jan 10, 2011 at 10:08, Nils Becker <n.bec...@amolf.nl> wrote: > Hi, > > I noticed that I can index into a dtype when I take an element > of a rank-1 array but not if I make a rank-0 array directly. This seems > inconsistent. A bug?
Not a bug. Since there is no axis, you cannot use integers to index into a rank-0 array. Use an empty tuple instead. [~] |1> dt = np.dtype([('x', '<f8'), ('y', '<f8')]) [~] |2> a_rank_0 = np.zeros((), dtype=dt) [~] |3> a_rank_0[()] (0.0, 0.0) -- 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