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


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

Re: id == vs is

Started byBen Finney <ben+python@benfinney.id.au>
First post2014-10-27 11:40 +1100
Last post2014-10-27 11:40 +1100
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: id == vs is Ben Finney <ben+python@benfinney.id.au> - 2014-10-27 11:40 +1100

#79740 — Re: id == vs is

FromBen Finney <ben+python@benfinney.id.au>
Date2014-10-27 11:40 +1100
SubjectRe: id == vs is
Message-ID<mailman.15213.1414370706.18130.python-list@python.org>
Dan Stromberg <drsalists@gmail.com> writes:

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

It depends what you mean by “the same”.

Do they give the same result? Sometimes yes, sometimes no. It depends on
what the types of the values are.

Do they express the same intent? Always no. The first queries object
identity, the second queries object equality.

-- 
 \              “Ridicule is the only weapon which can be used against |
  `\       unintelligible propositions.” —Thomas Jefferson, 1816-07-30 |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


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


csiph-web