On 8/31/06, Christopher Barker <Chris.Barker@noaa.gov> wrote:
Tom Denniston wrote:
> I would think one would want to throw an error when the data has
> inconsistent dimensions.
But it doesn't have inconsistent dimensions - they are perfectly
consistent with a (2,) array of objects. How is the code to know what
With numeric types, it is unambiguous to march down through the
sequences until you get a number. As a sequence is an object, there no
way to unambiguously do this automatically.
Perhaps the way to solve this is for the array constructor to take a
"shape" or "rank" argument, so you could specify what you intend. But
that's really just syntactic sugar to avoid for calling numpy.empty() first.
Perhaps a numpy.object_array() constructor would be useful, although as
I think about it, even specifying a shape or rank would not be unambiguous!
This is a useful discussion. If we ever get a nd-array into the standard
lib, I suspect that object arrays will get heavy use -- better to clean
up the semantics now.
Perhaps a Wiki page on building object arrays is called for.