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


Groups > comp.lang.python > #108254

Why do these statements evaluate the way they do?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Anthony Papillion <anthony@cajuntechie.org>
Newsgroups comp.lang.python
Subject Why do these statements evaluate the way they do?
Date Sat, 07 May 2016 01:36:48 -0500
Lines 18
Message-ID <mailman.446.1462603041.32212.python-list@python.org> (permalink)
References <9D4F2568-405C-419B-9B18-7376B34143CD@cajuntechie.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 25RN06VCxbuM5EPS2PZ7CAs3WcBNa6OoUMyaqpbUmycw==
Return-Path <anthony@cajuntechie.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'statements': 0.09; 'subject:Why': 0.09; 'equal.': 0.16; 'from:addr:anthony': 0.16; 'reason.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:name:python list': 0.16; 'fairly': 0.22; 'trying': 0.22; 'header:User-Agent:1': 0.26; 'example': 0.26; 'figure': 0.27; 'device': 0.28; "i'm": 0.30; 'received:184': 0.30; 'false': 0.35; 'identity': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'say': 0.37; 'someone': 0.38; 'why': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'evaluate': 0.72; 'mail.': 0.75; 'hoping': 0.77
User-Agent K-9 Mail for Android
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <9D4F2568-405C-419B-9B18-7376B34143CD@cajuntechie.org>
Xref csiph.com comp.lang.python:108254

Show key headers only | View raw


I'm trying to figure out why the following statements evaluate the way they do and I'm not grasping it for some reason. I'm hoping someone can help me.

40+2 is 42 #evaluates to True
But
2**32 is 2**32 #evaluates to False

This is an example taken from a Microsoft blog on the topic. They say the reason is because the return is based on identity and not value but, to me, these statements are fairly equal.

Can someone clue me in?

Anthony
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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


Thread

Why do these statements evaluate the way they do? Anthony Papillion <anthony@cajuntechie.org> - 2016-05-07 01:36 -0500
  Re: Why do these statements evaluate the way they do? Steven D'Aprano <steve@pearwood.info> - 2016-05-07 20:05 +1000

csiph-web