[Numpy-discussion] Problem with concatenate and object arrays

Charles R Harris charlesr.harris at gmail.com
Wed Sep 6 16:08:08 CDT 2006


On 9/5/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> Matthew Brett wrote:
> > Hi,
> >
> >
> >> This is a result of PyArray_FromAny changing when object arrays are
> >> explicitly requested (which they are in this case --- although behind
> >> the scenes).
> >>
> >
> > Hmm - I think I am hitting a related bug/feature/surprising change in
> > behavior, which is showing up rather obscurely in a failure of the
> > scipy.io matlab loading tests:
> >
> > http://projects.scipy.org/scipy/scipy/ticket/258
> >
> > Here's the change I wasn't expecting, present with current SVN:
> >
> > a = arange(2)
> > b = arange(1)
> > c = array([a, b], dtype=object)
> > c
> > ->
> > array([[0, 1],
> >        [0, 0]], dtype=object)
> >
> > On a previous version of numpy (1.02b.dev2975) I get the answer I was
> expecting:
> >
> > array([[0], [0 1]], dtype=object)
> >
>
> This should now be fixed.  The code was inappropriately not checking for
> dimensions when object arrays were being constructed.  Now, it raises
> the appropriate error and then interprets it correctly using the extra
> object creation code.
>
> Users of scipy 0.5.1 will only have to upgrade NumPy to get the fix (the
> SciPy install won't have to be re-built).
>
> -Travis


Where is array at this point? I would like to review the documented
behaviour and make modifications to the document string if required. What
about Robert's idea of a separate constructor for object arrays? Is it
something we could introduce on top of the current array constructor? I
realize that if we restrict the current array constructor there might be
compatibility problems with Numeric code, but introducing something like
oarray as a shorthand for object arrays might incourage it's use. Robert
also said that Numarray dealt with object arrays as a separate issue and I
wonder what they did that we should think about.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060906/ad3e06df/attachment.html 


More information about the Numpy-discussion mailing list