NaN comparisons - Call For Anecdotes

Chris Angelico rosuav at
Thu Jul 17 20:59:56 CEST 2014

On Fri, Jul 18, 2014 at 4:49 AM, Johann Hibschman <jhibschman at> wrote:
> In
> principle, (NA == 1.0) should be a NA (missing) truth value, as should
> (NA == NA), but in practice having it be False is more useful.

This is actually fairly easily implemented, if you ever want it.

class NAType:
    def __repr__(self): return "NA"
    def __eq__(self, other): return self
    __lt__ = __gt__ = __le__ = __ge__ = __ne__ = __eq__
NA = NAType()


More information about the Python-list mailing list