On Tue, Sep 29, 2015 at 6:58 PM, Chris Barker - NOAA Federal <chris.barker@noaa.gov> wrote:One of the usecases that has sneaked in during the last few numpy versions is that object arrays contain numerical arrays where the shapes don't add up to a rectangular array.I think that's the wrong way to dve that problem -- we really should have a "proper" ragged array implementation. But is is the easiest way at this point.For this, and other use-cases, special casing Numpy arrays stored in object arrays does make sense:"If this is s a Numpy array, pass the operation through."Because we now (development) use rich compare, the result looks like
In [1]: a = ones(3)
In [2]: b = array([a, -a], object)
In [3]: b
Out[3]:
array([[1.0, 1.0, 1.0],
[-1.0, -1.0, -1.0]], dtype=object)
In [4]: sign(b)
Out[4]:
array([[1L, 1L, 1L],
[-1L, -1L, -1L]], dtype=object)The function returns long integers in order to not special case Python 3. Hmm, wonder if we might want to change that.
Chuck