Attributes vs functions in numarray.
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
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.
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
[Me (Tim Hochberg)]
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,...).
[Paul F Dubois]
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.
Fair enough, but what about attributes new to numarray (rank, type, maybe others). Is the preference then for function syntax over attribute syntax? I'd prefer the latter, but I'm mostly trying to figure out what the pattern is. -tim
On Mon, 2002-09-16 at 22:11, Tim Hochberg wrote:
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,...).
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
Thanks,
-tim
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-- ------------------------------------------------------------------------- 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