[Numpy-discussion] deprecate numpy.matrix
Alan G Isaac
alan.isaac at gmail.com
Mon Feb 10 17:31:52 EST 2014
On 2/10/2014 5:11 PM, Pauli Virtanen wrote:
> The existence of np.matrix messes up the general agreement on ndarray
> semantics in Python. The meaning of very basic code such as
>
> A * B
> A.sum(0)
> A[0]
>
> where A and B are NxN matrices of some sort now depends on the types
> of A and B. This makes writing duck typed code impossible when both
> semantics are in play.
I'm just missing the point here; sorry.
Why isn't the right approach to require that
any object that wants to work with scipy
can be called by `asarray` to guarantee
the core semantics? (And the matrix
object passes this test.) For some objects
we can agree that `asarray` will coerce them.
(E.g., lists.)
I just do not see why scipy should care about
the semantics an object uses for interacting
with other objects of the same type.
Alan Isaac
More information about the NumPy-Discussion
mailing list