Re: [Numpy-discussion] __getitem__ and creating an array of objects

2013-05-30 Thread Robert Kern
On Thu, May 30, 2013 at 10:31 PM, Aldcroft, Thomas wrote: > Now I realize what seemed curious. Here is a related example which shows > that when initializing a numpy array of objects where __getitem__ and > __len__ exist, np.array introspects the object item values for item in > range(len(object

Re: [Numpy-discussion] __getitem__ and creating an array of objects

2013-05-30 Thread Aldcroft, Thomas
On Thu, May 30, 2013 at 4:58 PM, Aldcroft, Thomas < aldcr...@head.cfa.harvard.edu> wrote: > > > > On Thu, May 30, 2013 at 4:27 PM, Robert Kern wrote: > >> On Thu, May 30, 2013 at 9:21 PM, Aldcroft, Thomas >> wrote: >> > I'm seeing some behavior that I can't understand when creating a numpy >> arr

Re: [Numpy-discussion] __getitem__ and creating an array of objects

2013-05-30 Thread Aldcroft, Thomas
On Thu, May 30, 2013 at 4:27 PM, Robert Kern wrote: > On Thu, May 30, 2013 at 9:21 PM, Aldcroft, Thomas > wrote: > > I'm seeing some behavior that I can't understand when creating a numpy > array > > of Python objects. Basically it seems that np.array() is calling the > object > > __getitem__ m

Re: [Numpy-discussion] __getitem__ and creating an array of objects

2013-05-30 Thread Robert Kern
On Thu, May 30, 2013 at 9:21 PM, Aldcroft, Thomas wrote: > I'm seeing some behavior that I can't understand when creating a numpy array > of Python objects. Basically it seems that np.array() is calling the object > __getitem__ method for one object class but not another class, and I can't > unde

[Numpy-discussion] __getitem__ and creating an array of objects

2013-05-30 Thread Aldcroft, Thomas
I'm seeing some behavior that I can't understand when creating a numpy array of Python objects. Basically it seems that np.array() is calling the object __getitem__ method for one object class but not another class, and I can't understand the difference. Here is an example, starting with a simple