Attributes vs functions in numarray.
![](https://secure.gravatar.com/avatar/5b2449484c19f8e037c5d9c71e429508.jpg?s=120&d=mm&r=g)
Can someone refresh my memory as to why some properties of NumArrays that are conceptually attributes are accessed as atributes (a.shape, a.rank), while others are accessed through functions (a.type, a.iscontiguous,...). Thanks, -tim
![](https://secure.gravatar.com/avatar/56475d2e8acb48b4308f609982f94440.jpg?s=120&d=mm&r=g)
Because that is what Numeric did, and as explained in the position statement on the numpy website, we are not changing things unless we have a compelling reason. Numeric did some things like a.shape as properties rather than pairs of get/set functions; there was no special reason for it except a feeling that it was easier to type or looked more mathematical. E.g., x.imaginary. I think the driving reason for shape was interactive use: x.shape=(4,5) However we got here, we aren't going to debate changing any of this. The scalar issue is on the table because it causes actual trouble for real people rather than philosophical inconsistency.
![](https://secure.gravatar.com/avatar/947028b0d6f0eb1344f5be4e2f686c27.jpg?s=120&d=mm&r=g)
On Mon, 2002-09-16 at 22:11, Tim Hochberg wrote:
Yes, I'd like to understand as well; there is even a third. There are attributes, e.g. a.shape vs methods, e.g. a.type() vs functions e.g. len(a). Regards, Ralf
-- ------------------------------------------------------------------------- Ralf Jüngling Institut für Informatik - Lehrstuhl f. Mustererkennung & Bildverarbeitung Georges-Köhler-Allee Gebäude 52 Tel: +49-(0)761-203-8215 79110 Freiburg Fax: +49-(0)761-203-8262 -------------------------------------------------------------------------
![](https://secure.gravatar.com/avatar/56475d2e8acb48b4308f609982f94440.jpg?s=120&d=mm&r=g)
Because that is what Numeric did, and as explained in the position statement on the numpy website, we are not changing things unless we have a compelling reason. Numeric did some things like a.shape as properties rather than pairs of get/set functions; there was no special reason for it except a feeling that it was easier to type or looked more mathematical. E.g., x.imaginary. I think the driving reason for shape was interactive use: x.shape=(4,5) However we got here, we aren't going to debate changing any of this. The scalar issue is on the table because it causes actual trouble for real people rather than philosophical inconsistency.
![](https://secure.gravatar.com/avatar/947028b0d6f0eb1344f5be4e2f686c27.jpg?s=120&d=mm&r=g)
On Mon, 2002-09-16 at 22:11, Tim Hochberg wrote:
Yes, I'd like to understand as well; there is even a third. There are attributes, e.g. a.shape vs methods, e.g. a.type() vs functions e.g. len(a). Regards, Ralf
-- ------------------------------------------------------------------------- Ralf Jüngling Institut für Informatik - Lehrstuhl f. Mustererkennung & Bildverarbeitung Georges-Köhler-Allee Gebäude 52 Tel: +49-(0)761-203-8215 79110 Freiburg Fax: +49-(0)761-203-8262 -------------------------------------------------------------------------
participants (3)
-
Paul F Dubois
-
Ralf Juengling
-
Tim Hochberg