![](https://secure.gravatar.com/avatar/d87a1cccf54e87545922851d4eafd8ed.jpg?s=120&d=mm&r=g)
Hi! I'm working on the Scalar Base Class category and, after a little bit of a shaky start, I think I have a pretty good handle on it now. I wanted to see for my self whether or not generic.base is "settable" (i.e., after object creation), so I instantiated an np.complex64 object, ala g = np.complex64(1) and then tried various ways (e.g., h=g.copy(), h=g.view(), h=g.real, h=g.imag) to create a view of g (i.e., create an object that shared its memory), but in all cases h.base returned None, meaning, IIUC, h is _not_ a view of (does not share memory with) g. So my questions are: are objects derived from generic "viewable"; is so, how; if not, why the base property? Thanks! DG
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
On Tue, Jul 14, 2009 at 00:50, David Goldsmith<d_l_goldsmith@yahoo.com> wrote:
Hi! I'm working on the Scalar Base Class category and, after a little bit of a shaky start, I think I have a pretty good handle on it now. I wanted to see for my self whether or not generic.base is "settable" (i.e., after object creation), so I instantiated an np.complex64 object, ala
g = np.complex64(1)
and then tried various ways (e.g., h=g.copy(), h=g.view(), h=g.real, h=g.imag) to create a view of g (i.e., create an object that shared its memory), but in all cases h.base returned None, meaning, IIUC, h is _not_ a view of (does not share memory with) g. So my questions are: are objects derived from generic "viewable";
They are not. The scalar types need to be immutable and allowing views would make violating that too easy.
is so, how; if not, why the base property?
So as to expose a consistent interface. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (2)
-
David Goldsmith
-
Robert Kern