Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105563

Re: 0 equals False, was Re: (unknown)

From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: 0 equals False, was Re: (unknown)
Date 2016-03-23 14:00 -0400
Message-ID <mailman.62.1458756067.2244.python-list@python.org> (permalink)
References <CAFWQgO=o-rPavakLZZBRxAthM5g7xE=Mn4hwcFPxTUvCEXn7SQ@mail.gmail.com> <nctleq$5t6$1@ger.gmane.org>

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 0 equals False, was Re: (unknown) Terry Reedy <tjreedy@udel.edu> - 2016-03-23 14:00 -0400

csiph-web