0 equals False, was Re: (unknown)

Terry Reedy tjreedy at udel.edu
Wed Mar 23 14:00:48 EDT 2016


On 3/23/2016 4:51 AM, Peter Otten wrote:

> The pythonic solution is "don't do this". The == operator cannot
> discriminate between 0, 0.0, and False,

and 0j and Fraction(0, 1) and Decimal(0)

> or 1, 1.0, and True

and 1+0j, Fraction(1, 1) and Decimal(1)

Sets and dicts are based both based on (transitive) equality.

-- 
Terry Jan Reedy




More information about the Python-list mailing list