[Numpy-discussion] fromfile() for reading text (one more time!)

Christopher Barker Chris.Barker at noaa.gov
Thu Jan 7 18:29:16 EST 2010


josef.pktd at gmail.com wrote:
>>> +1   (much preferrable to insert NaN or other user value than raise
>>> ValueError in my opinion)

>> But raise an error for integer types?
>>
>> I guess this is still up the air -- no consensus yet.
> 
> raise an exception, I hate the silent cast of nan to integer zero,

me too -- I'm sorry, I wasn't clear -- I'm not going to write any code 
that returns a zero for a missing value. These are the options I'd consider:

1) Have the user specify what to use for missing values, otherwise, 
raise an exception

2) Insert a NaN for floating points types, and raise an exception for 
integer types.

what's not clear is whether (2) is a good idea. As for (1), I just don't 
know if I'm going to get around to writing the code, and I maybe more 
kwargs is a bad idea -- though maybe not.

Enough talk: I've got ugly C code to wade through...

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

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

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list