[Numpy-discussion] Release of NumPy
Wed Apr 16 12:01:45 CDT 2008
On Wed, Apr 16, 2008 at 10:06:05AM -0400, Alan G Isaac wrote:
> > if you want a submatrix you should provide both indices
> > (possibly including a ":").
> Yes. We exactly agree on this.
> Please persuade Stefan.
Alan, instead of trying blindly to persuade Stefan, please listen to his
arguments. Or code an example implementation and show it to us. Stefan,
and incidently myself, believe your position cannot be described in a
consistent way, and that the day you try to code it, it will fall down.
This is why the RowVector and ColumnVector idea was proposed. For me it
is the only consistent proposal I have heard so far. I don't care that
much about all this, but I do care that you are trying to get developpers
lose their time on something that cannot work.
> But none of this answers the question:
> what should you get when you iterate over a matrix.
> Stefan seems to agree with me to this extent:
> we should get its "rows". This disagreement is
> over what that means:
> are these submatrices, a new vector object, or 1d arrays?
> I claim that if you use matrices, you will find it
> natural for these to be 1d arrays.
OK, let us pretend A[:, 1] returns a 1D array, as you seem to be wanting,
(A and B are matrices),
What is A[1, :] * B then? You are multiply an array with a matrix. That
already is dodgy, but numpy deals with it, and you get what you want.
What about B*A[:, 1]? You don't get what you want here. So you have
broken the user's expectation once again.
The question is should we break this expectation (1), the expectation that
A[x][y] = A[x, y] (2), or add RowVector and ColumnVector (3)?
I believe that 3 is better than 2, which is better than 1.
By the way, I think this has already been discussed. Let us not have the
discussion go in circles, and try to keep in mind the different
Maybe I am wrong, and you can make this work in a consistent way. In this
case prove me wrong, and write some demo code that does this. The numpy
developpers can than work with you to adapt it to a patch for numpy, and
it can go in.
> > That said, I don't actually use matrices, so I don't get a vote.
> As far as I know, no objections have been raised by users of
> matrices. In this sense, the objections have all been "abstract":
> they do not reflect experience with the implied convenience
> or inconvenience or particular behaviors.
I have seen many times users ask for langage features that break its
consistency, just because they do not realize it. The fact that you can
use a language doesn't mean that you are skilled-enough to invent one.
More information about the Numpy-discussion