A struct for 2.4 that supports float's inf and nan?

Joshua J. Kugler joshua at eeinternet.com
Wed Sep 19 16:58:15 EDT 2007


I'm trying to put some values into a struct.  Some of these values are NaN
and Inf due to the nature of the data.  As you well may know, struct (and 
other things) in Python <= 2.4 doesn't support inf and nan float values. 
You get the dreaded "SystemError: frexp() result out of range" error.

Before I go and write my own little wrapper, has anyone out there written
an "extended" struct that supports the inf and nan values?  I know this is
fixed in 2.5, but using that isn't an option at this point, as users will
be running older versions of python.

I suppose I could get the relevant source from the 2.5 source and compile it
as a custom package, but that wouldn't be very transparent for my users,
and would probably be getting in way over my head. :)

Ideas?  Suggestions?

j

-- 
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE




More information about the Python-list mailing list