[Numpy-discussion] untenable matrix behavior in SVN
Alan G Isaac
Fri Apr 25 13:02:02 CDT 2008
On Fri, 25 Apr 2008, Stéfan van der Walt apparently wrote:
> Reverted in r5084.
I think we have discovered that there is a basic conflict
between two behaviors:
x == x[0,:]
x == x[0,0]
To my recollection, everyone has agree that the second
behavior is desirable as a *basic expectation* about the
behavior of 2d objects. This implies that *eventually* we
will have ``x == x[0,0]``. But then eventually
we MUST eventually have x != x[0,:].
Since a current behavior must disappear eventually, we
should make it disappear as soon as possible: before the
release. The question is how. I see two simple ways to
move forward immediately:
1. scalar indexing of matrices returns a 1d array
2. scalar indexing of matrices raises a TypeError
If we raise a TypeError, we lose both behaviors.
If we return a 1d array, we retain the behavior
that has been seen as desirable (as a *basic expectation*
about the behavior of 2d objects).
Stefan, do you agree, and if so, would you be willing to
have a vote on these two options?
More information about the Numpy-discussion