[Numpy-discussion] Questions about the array interface.

Andrew Straw strawman at astraw.com
Thu Apr 7 15:56:03 EDT 2005


Travis Oliphant wrote:

> Scott Gilbert wrote:
>
>> --- "David M. Cooke" <cookedm at physics.mcmaster.ca> wrote:
>>  
>>
>>>> Good point, but a pain. Maybe they should be required, that way I
>>>> don't have to first check for the presence of '<' or '>', then check
>>>> if they have the right value.
>>>>     
>>>
>>> I'll second this. Pulling out more Python Zen: Explicit is better than
>>> implicit.
>>>
>>>   
>>
>>
>> I'll third.
>>  
>>
>
> O.K.  It's done....
>
Here's a bit of weirdness which has prevented me from using '<' or '>' 
in the past with the struct module.  I'm not guru enough to know what's 
going on, but it has prevented me from being explicit rather than implicit.

In [1]:import struct

In [2]:from numarray.ieeespecial import nan

In [3]:nan
Out[3]:nan

In [4]:struct.pack('<d',nan)
---------------------------------------------------------------------------
exceptions.SystemError                               Traceback (most 
recent call last)

/home/astraw/<console>

SystemError: frexp() result out of range

In [5]:struct.pack('d',nan)
Out[5]:'\x00\x00\x00\x00\x00\x00\xf8\xff'





More information about the NumPy-Discussion mailing list