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


Groups > comp.lang.python > #10823

Re: Equality check

Date 2011-08-03 15:15 -0400
From Dave Angel <davea@ieee.org>
Subject Re: Equality check
References <CAGTE2R0JKQKM+-Pdd0r6=jRFi5gW3f20fHqSuq3OgHmQTimeSA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1861.1312399277.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 01/-10/-28163 02:59 PM, Abhishek Jain wrote:
> How to check equality of two nos. in python
>
Python doesn't have numbers, it has various numeric data types.  If all 
you're concerned with are int types, then just use the obvous:

      if  a == b:
             dosomething....

If one or both might be floats, you have to deal with the likelihood 
that one or both may have quantization error, either caused by 
computational approximations, precision limitations, or conversion back 
and forth between string and internal binary representation.

If one is in Decimal, you have to mostly deal with the first two.

If one is complex, ...

DaveA

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


Thread

Re: Equality check Dave Angel <davea@ieee.org> - 2011-08-03 15:15 -0400

csiph-web