[Numpy-discussion] how to work with numpy.int8 in c
Warren Weckesser
warren.weckesser@enthought....
Tue Mar 2 18:18:51 CST 2010
James Bergstra wrote:
> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
> <Chris.Barker@noaa.gov> wrote:
>
>> James Bergstra wrote:
>>
>>> Maybe I'm missing something... but I don't think I want to create an array.
>>>
>>> In [3]: import numpy
>>>
>>> In [4]: type(numpy.int8())
>>> Out[4]: <type 'numpy.int8'>
>>>
>>> In [5]: isinstance(numpy.int8(), numpy.ndarray)
>>> Out[5]: False
>>>
>> right, it's a type object:
>>
>> In [13]: type(np.uint8)
>> Out[13]: <type 'type'>
>>
>>
> Agreed :)
>
>>> I want to create one of those numpy.int8 guys.
>>>
>
> np.int8 is a type, and so is numpy.ndarray. And they are different.
> There's lots of docs about how to make arrays, but how do I make a
> scalar?
>
In [1]: import numpy as np
In [2]: x = np.uint8(23)
In [3]: x
Out[3]: 23
In [4]: type(x)
Out[4]: <type 'numpy.uint8'>
Warren
More information about the NumPy-Discussion
mailing list