Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-06 Thread Christopher Barker
Robert Kern wrote: Chris Barker wrote: What if your objects were nested sequences, and you wanted to partly flatten them -- which would you flatten? I'm pretty sure that that is exactly the ambiguity that the depth option resolves. Can you give me an example where it's still ambiguous with

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-06 Thread Robert Kern
Christopher Barker wrote: Robert Kern wrote: Chris Barker wrote: What if your objects were nested sequences, and you wanted to partly flatten them -- which would you flatten? I'm pretty sure that that is exactly the ambiguity that the depth option resolves. Can you give me an example where

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Pearu Peterson
On Fri, January 4, 2008 8:00 pm, Pearu Peterson wrote: On Fri, January 4, 2008 7:33 pm, Travis E. Oliphant wrote: Pearu Peterson wrote: Hi, Say, one defines class A(tuple): def __repr__(self): return 'A(%s)' % (tuple.__repr__(self)) and I'd like to create an array of A instances.

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Pearu Peterson
On Fri, January 4, 2008 8:00 pm, Pearu Peterson wrote: On Fri, January 4, 2008 7:33 pm, Travis E. Oliphant wrote: Pearu Peterson wrote: Hi, Say, one defines class A(tuple): def __repr__(self): return 'A(%s)' % (tuple.__repr__(self)) and I'd like to create an array of A instances.

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Travis E. Oliphant
Charles R Harris wrote: On Jan 4, 2008 11:13 AM, Pearu Peterson [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Fri, January 4, 2008 7:33 pm, Travis E. Oliphant wrote: So, create an empty object array and insert the entries the way you want them: a =

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Pearu Peterson
Just ignore this solution. It was not quite working and I was able to get a segfault from it. Pearu On Fri, January 4, 2008 8:58 pm, Pearu Peterson wrote: On Fri, January 4, 2008 8:00 pm, Pearu Peterson wrote: On Fri, January 4, 2008 7:33 pm, Travis E. Oliphant wrote: Pearu Peterson wrote:

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Chris Barker
Travis E. Oliphant wrote: I like the depth option, and that could be used with the current interface without too much difficulty, I think. This question does come up quite often and should probably be addressed. Yes, it has, but the depth option was discussed too, and while it might solve

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Robert Kern
Chris Barker wrote: Travis E. Oliphant wrote: I like the depth option, and that could be used with the current interface without too much difficulty, I think. This question does come up quite often and should probably be addressed. Yes, it has, but the depth option was discussed too,