[Numpy-discussion] eye and identity: why both?

Sven Schreiber svetosch at gmx.net
Fri Jun 23 03:54:49 CDT 2006

identity seems to be a "crippled" version of eye without any value
added, apart from backwards-compatibility;

So from a user point of view, which one does numpy recommend?

And from a developer point of view (which doesn't really apply to me, of
course), should identity maybe become an alias for eye(n, dtype=...)?

Or is there a subtle (or not so subtle...) difference I am missing?

I am aware this question is not really that important since everything
works, but when I read that there will be a 1.0beta soon I thought maybe
this is the right time to ask those kind of questions.

Here are the help-strings:

eye(N, M=None, k=0, dtype=<type 'int32scalar'>)
    eye returns a N-by-M 2-d array where the  k-th diagonal is all ones,
    and everything else is zeros.

identity(n, dtype=<type 'int32scalar'>)
    identity(n) returns the identity 2-d array of shape n x n.


More information about the Numpy-discussion mailing list