[Numpy-discussion] get a dtypes' range?

Christopher Barker Chris.Barker@noaa....
Fri Jun 17 14:26:10 CDT 2011

Robert Kern wrote:
> 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)

|34> dir(d)...

> The numpy *scalar* types do, 

OK -- that is, indeed, what I observed, from:



> 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.

That's handy.

I guess I'm confused about the difference between:




since I always pass in the later when a dtype is called for.


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception


More information about the NumPy-Discussion mailing list