Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Johann Hibschman Newsgroups: comp.lang.python Subject: Re: NaN comparisons - Call For Anecdotes Date: Thu, 17 Jul 2014 11:12:28 -0400 Organization: A noiseless patient Spider Lines: 25 Message-ID: References: <53BC05FB.4050707@jmunch.dk> <53BD70F4.4000504@stoneleaf.us> <53BDAF90.8010709@jmunch.dk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="bf8df648563a652600991a2f46263256"; logging-data="8619"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Se16QT6mfwBqUSLWLaBFHmwU74Crb9EM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) Cancel-Lock: sha1:V2huuyHdAzQ17D0k5xGTwFwDt7w= sha1:Clp2QnHpW8uP+zNiwAR7UOwuWQY= Xref: csiph.com comp.lang.python:74642 "Anders J. Munch" <2014@jmunch.dk> writes: > So far I received exactly the answer I was expecting. 0 examples of > NaN!=NaN being beneficial. > I wasn't asking for help, I was making a point. Whether that will > lead to improvement of Python, well, I'm not too optimistic, but I > feel the point was worth making regardless. Well, I just spotted this thread. An easy example is, well, pretty much any case where SQL NULL would be useful. Say I have lists of borrowers, the amount owed, and the amount they paid so far. nan = float("nan") borrowers = ["Alice", "Bob", "Clem", "Dan"] amount_owed = [100.0, nan, 200.0, 300.0] amount_paid = [100.0, nan, nan, 200.0] who_paid_off = [b for (b, ao, ap) in zip(borrowers, amount_owed, amount_paid) if ao == ap] I want to just get Alice from that list, not Bob. I don't know how much Bow owes or how much he's paid, so I certainly don't know that he's paid off his loan. Cheers, Johann