Re: [Numpy-discussion] recarray field access asymmetry

2012-02-15 Thread David Gowers (kampu)
Hi Ben, Thanks for your prompt response. On Wed, Feb 15, 2012 at 6:40 PM, Benjamin Root wrote: > >> >> Rather than recarrays, I just use structured arrays like so: >> >> A = np.array([(0, 0), (0, 0), (0, 0), (0, 0)], >>                dtype=[('x', '> >> I can then do: >> >> A['x'][0] >> >> Or >>

Re: [Numpy-discussion] recarray field access asymmetry

2012-02-15 Thread Benjamin Root
On Wednesday, February 15, 2012, Benjamin Root wrote: > > > On Wednesday, February 15, 2012, David Gowers (kampu) <00a...@gmail.com> wrote: >> Hi all, >> >> This email is about the difference, given a recarray 'arr', >> between >> >> >> A) >> >> arr.foo.x[0] >> >> and B) >> >> arr.foo[0].x >> >>

Re: [Numpy-discussion] recarray field access asymmetry

2012-02-15 Thread Benjamin Root
On Wednesday, February 15, 2012, David Gowers (kampu) <00a...@gmail.com> wrote: > Hi all, > > This email is about the difference, given a recarray 'arr', > between > > > A) > > arr.foo.x[0] > > and B) > > arr.foo[0].x > > > > Specifically, form A returns the 0-th x value, whereas form B raises > A

[Numpy-discussion] recarray field access asymmetry

2012-02-14 Thread David Gowers (kampu)
Hi all, This email is about the difference, given a recarray 'arr',  between A) arr.foo.x[0] and B) arr.foo[0].x Specifically, form A returns the 0-th x value, whereas form B raises AttributeError: Some code demonstrating this: >>> arr = np.zeros((4,), dtype = [('foo',[('x','H'),('y','H