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


Groups > comp.lang.python > #79733 > unrolled thread

id == vs is

Started byDan Stromberg <drsalists@gmail.com>
First post2014-10-26 17:12 -0700
Last post2014-10-27 01:47 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  id == vs is Dan Stromberg <drsalists@gmail.com> - 2014-10-26 17:12 -0700
    Re: id == vs is Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-27 01:47 +0000

#79733 — id == vs is

FromDan Stromberg <drsalists@gmail.com>
Date2014-10-26 17:12 -0700
Subjectid == vs is
Message-ID<mailman.15206.1414368757.18130.python-list@python.org>
Are the following two expressions the same?

x is y

Id(x) == id(y)

?

I ported some Java code to Python, and it was using Java's idea of
equality (via ==) in some places.  Right now, I have a suite of unit
tests working using the second expression above, but I'm thinking
about switching to the first.

Thanks!

[toc] | [next] | [standalone]


#79743

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-10-27 01:47 +0000
Message-ID<m2k87s$mgr$2@dont-email.me>
In reply to#79733
On Sun, 26 Oct 2014 17:12:29 -0700, Dan Stromberg wrote:

> Are the following two expressions the same?
> 
> x is y
> 
> Id(x) == id(y)

No, although if "Id" and "id" were the same function, they might be 
equivalent in some cases. 

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web