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?

From Anthony Papillion <anthony@cajuntechie.org>
Newsgroups comp.lang.python
Subject Why do these statements evaluate the way they do?
Date 2016-05-07 01:36 -0500
Message-ID <mailman.446.1462603041.32212.python-list@python.org> (permalink)
References <9D4F2568-405C-419B-9B18-7376B34143CD@cajuntechie.org>

Show all headers | 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