[Numpy-discussion] get a dtypes' range?
Fri Jun 17 13:34:19 CDT 2011
On Fri, Jun 17, 2011 at 13:27, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> Actually, I'm a bit confused about dtypes from an OO design perspective
> anyway. I note that the dtypes seem to have all (most?) of the methods
> of ndarrays (or placeholders, anyway), which I don't quite get.
No, they don't.
|33> d = np.dtype(float)
The numpy *scalar* types do, because they are actual Python types just
like any other. They provide the *unbound* methods (i.e. you cannot
call them) that will be bound when an instance of it gets created. And
the scalar types have many of the same methods as ndarray to allow
some ability to write generic functions that will work with either
arrays or scalars.
"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