[SciPy-dev] generic.base

Robert Kern robert.kern@gmail....
Tue Jul 14 02:06:20 CDT 2009

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

More information about the Scipy-dev mailing list