Re: [Numpy-discussion] Empty record arrays

2007-03-05 Thread Sameer DCosta
On 3/5/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > empty() works too, but why would you want an empty array? I wanted to use rec.fromrecords so that the interface is consistent. For example, suppose I have a list comprehension that generates the variable "recs". Sometimes the list compreh

Re: [Numpy-discussion] Empty record arrays

2007-03-05 Thread Robert Kern
Christopher Barker wrote: > empty() works too, but why would you want an empty array? Consistently handling edge-case inputs to library functions. -- 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 interpr

Re: [Numpy-discussion] Empty record arrays

2007-03-05 Thread Christopher Barker
empty() works too, but why would you want an empty array? >>> import numpy as N >>> dt = [("name", "S30"), ("age", "i2"), ("weight", "f4")] >>> a = N.empty((0,), dtype=dt) >>> a array([], dtype=[('name', '|S30'), ('age', '>i2'), ('weight', '>f4')]) -Chris Sameer DCosta wrote: > Hi, >

[Numpy-discussion] Empty record arrays

2007-03-05 Thread Sameer DCosta
Hi, I am trying to create record arrays using the numpy.rec.fromrecords. This function works just fine, however I am having a little trouble using it to create empty record arrays. If the array I start off with is empty and I have provided a dtype (or the names and the formats), then I expect rec.