float("nan") in set or as key

Chris Torek nospam at torek.net
Mon May 30 01:53:33 EDT 2011


In article <irv6ev01jht at news1.newsguy.com> I wrote, in part:
>    _inf = float("inf")
>    def isinf(x):
>        return x == _inf
>    del _inf

Oops, take out the del, or otherwise fix the obvious problem,
e.g., perhaps:

    def isinf(x):
        return x == isinf._inf
    isinf._inf = float("inf")

(Of course, if something like this were adopted properly, it would
all be in the base "float" type anyway.)
-- 
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W)  +1 801 277 2603
email: gmail (figure it out)      http://web.torek.net/torek/index.html



More information about the Python-list mailing list