[PYTHON MATRIX-SIG] Attributes vs. methods

James Hugunin jjh@Goldilocks.LCS.MIT.EDU
Fri, 19 Jan 96 16:20:44 EST

   Date: Fri, 19 Jan 1996 15:36:12 -0500
   From: hinsenk@ERE.UMontreal.CA (Hinsen Konrad)
   Cc: dubois1@llnl.gov, matrix-sig@python.org

      a.typecode, a.itemsize, a.contiguous should all become methods,
      because setting these values makes no sense.

   They could also be read-only attributes. BTW, setting a.typecode
   does make sense, as a way of casting an array to another type.
   Of course this is not the recommended style.

Unfortunately, this can not be done with the current implementation of
array objects.  Because it is possible to have arrays that are
references to the memory of another array, it is essential that
casting produce a new array rather than modify the existing one.

Right now they are read-only attributes, but I think I've come to
agree with Paul that read-only attributes are a little bit confusing.


MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org