[Numpy-discussion] fixed-point arithmetic

Robert Kern robert.kern@gmail....
Fri Sep 25 14:04:42 CDT 2009


On Fri, Sep 25, 2009 at 13:57, Neal Becker <ndbecker2@gmail.com> wrote:

> I'm still a bit confused.  The dtype is a PyTypeObject?

No, dtypes are PyArrayDescr's in C.

> It almost sounds
> like you're saying that the dtype is an PyObject instance, rather than a
> TypeObject.

Yup.

> But IIUC, you say it is a PyTypeObject, but one with an extract
> dict attached (which kindof acts like an instance).

In order to create the scalar objects, you would make a PyTypeObject
that will create the appropriate PyArrayDescr with the metadata dict.
The scalar types, like np.uint8, are not dtypes themselves. The
constructor for your PyTypeObject will have to be a little different
than the others, since it will also have to accept the metadata that
it will use to create the dtype object.

-- 
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 NumPy-Discussion mailing list