[Numpy-discussion] adding a .M attribute to the array.

Pearu Peterson pearu at cens.ioc.ee
Wed Mar 6 13:03:40 CST 2002

On Wed, 6 Mar 2002, Perry Greenfield wrote:

> This is a clever idea that reminds me of  something we were considering
> for something else (exactly what I can't quite remember :-). But like
> all such schemes it still does produce an object, and a user might
> infer (reasonably or unreasonably) that if they can type
> x = a.m * b
> Then they can treat a.m as an array, e.g.,
> x = a.m

Yes, I was also thinking about the same issue. If we could somehow
confince users that .m attribute comes only with operations, e.g.

   a  .m*  b

then it should be safe... Note that in order to use .m feature, an user
must read about it somewhere, say, from tutorial. And there should be
noted explicitely where _not_ to use .m feature, that is, in assignments
and in function arguments, in order to avoid side any unwanted 
side effects. Actually, library functions probably use asarray for
arguments, this function could also clean up the asmatrix bit.


More information about the Numpy-discussion mailing list