[Numpy-discussion] proposing a "beware of [as]matrix()" warning

Alan G Isaac aisaac@american....
Wed Apr 28 19:43:15 CDT 2010


> Alan wrote:
>> There is one change I would not mind: let
>> A * M be undefined if A is an ndarray and
>> M is a NumPy matrix.


On 4/28/2010 5:46 PM, David Warde-Farley wrote:
> What about the other binary ops? I would say, matrix goes with matrix,
> array with array, never the two shall meet unless you explicitly
> coerce. The ability to mix the two in a single expression does more
> harm than good, IMHO.


I would be fine with this.  I mentioned ``*`` explicitly,
because it is the dangerous one (most likely to cause
surprises).

Since M.A gives the array representation of the matrix M,
explicit "coercion" is almost costless.

Alan Isaac

PS Just to be clear, I'm just a user ...



More information about the NumPy-Discussion mailing list