# How to determine whether two variables refer to the same object

**URL:** <https://discourse.julialang.org/t/how-to-determine-whether-two-variables-refer-to-the-same-object/5400>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 16, 2017, 1:14am UTC](https://discourse.julialang.org/t/how-to-determine-whether-two-variables-refer-to-the-same-object/5400 "2017-08-16T01:14:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chong\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chong_wang/32/20307_2.png) [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Post date:** [August 16, 2017, 1:14am UTC](https://discourse.julialang.org/t/how-to-determine-whether-two-variables-refer-to-the-same-object/5400/1 "2017-08-16T01:14:07Z")

</div>

I have been googling for half an hour with no luck. In python, `a is b` can check whether `a` and `b` refer to the same object. What’s the counterpart in julia?

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [August 16, 2017, 1:18am UTC](https://discourse.julialang.org/t/how-to-determine-whether-two-variables-refer-to-the-same-object/5400/2 "2017-08-16T01:18:53Z")

</div>

```julia
help?> ===
search: === == .== !==

  ===(x,y) -> Bool
  ≡(x,y) -> Bool

  Determine whether x and y are identical, in the sense that no program could
  distinguish them. Compares mutable objects by address in memory, and
  compares immutable objects (such as numbers) by contents at the bit level.
  This function is sometimes called egal.

  julia> a = [1, 2]; b = [1, 2];

  julia> a == b
  true

  julia> a === b
  false

  julia> a === a
  true

```

---

<div class="post-metadata">

**Author:** ![Chong\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chong_wang/32/20307_2.png) [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Post date:** [August 16, 2017, 1:21am UTC](https://discourse.julialang.org/t/how-to-determine-whether-two-variables-refer-to-the-same-object/5400/3 "2017-08-16T01:21:33Z")

</div>

Thank you. Very useful.
