[Numpy-discussion] bug !? dtype type_descriptor does not accept zero length tuple

Travis Oliphant oliphant.travis at ieee.org
Wed Aug 9 18:18:10 EDT 2006


Sebastian Haase wrote:
> Hi!
> I have a problem with record array type descriptor.
> With numarray this used to work.
> My records made of  n integers and m floats.  So I used to be able specify
> formats="%di4,%df4"%(self.numInts,self.numFloats) in numarray which would 
> translate to 
> byteorder = self.isByteSwapped and '>' or '<'
> type_descr = [("int",   "%s%di4" %(byteorder,self.numInts)),
>                       ("float", "%s%df4" %(byteorder,self.numFloats))]
>
> The problem occurs when numInts or numFloats is zero !?
> Could it numpy be changed to silectly accept this case
> Here is the complete traceback + some debug info:
>   

If numarray supported it, then we should get NumPy to support it as well 
unless there is a compelling reason not to.  I can't think of any except 
that it might be hard to make it work.  What is '0i4' supposed to mean 
exactly?  Do you get a zero-sized field or is the field not included?   
I think the former will be much easier than the latter.   Would that be 
O.K.?

-Travis





More information about the NumPy-Discussion mailing list