[Numpy-discussion] untenable matrix behavior in SVN
Fri Apr 25 14:19:43 CDT 2008
On 25/04/2008, Charles R Harris <firstname.lastname@example.org> wrote:
> On Fri, Apr 25, 2008 at 12:02 PM, Alan G Isaac <email@example.com> wrote:
> > I think we have discovered that there is a basic conflict
> > between two behaviors:
> > x == x[0,:]
> > vs.
> > 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,:].
> 1) x equiv x[0:1,:] -- current behavior
> 2) x equiv x[0,:] -- array behavior, gives x == x[0,0]
> These are incompatible. I think 1) is more convenient in the matrix domain
> and should be kept, while 2) should be given up. What is the reason for
> wanting 2)? Maybe we could overload the () operator so that x(0) gives 2)?
> Or vice versa.
We are currently operating in a fog of abstraction, trying to decide
which operations are more "natural" or more in correspondence with our
imagined idea of a user. We're not getting anywhere. Let's start
writing up (perhaps on the matrix indexing wiki page) plausible use
cases for scalar indexing, and how they would look under each
* Iterating over the rows of a matrix:
# array-return proposal; x is a scalar
for row in M:
# exception-raising proposal
for i in xrange(M.shape):
More information about the Numpy-discussion