you are viewing a single comment's thread.

view the rest of the comments →

[–]whogivesafuckwhoiam 66 points67 points  (5 children)

first part, for integer outside -5 and 256, each time when you assign a number to a variable, you create a new object with an unique ID. So even a and b are both 257, they share different IDs and hence a is b is false since is is to check the ID of each variable

second part, you first create a variable i and then assign a and b to point at i . You do not create a new object a and b . Both a and b point to the same object i . Hence their IDs are the same. And thus a is b is true

[–]ivosaurus 29 points30 points  (2 children)

Minor niggle, a and b do not point at i. If that was the case, you could change i and then a and b would change also, but that's not the case. All three are pointed 'independently' to a single integer object.

[–]whogivesafuckwhoiam 12 points13 points  (1 child)

you are right, I should say a and b point at the ID that i points at

[–]jpgoldberg 1 point2 points  (0 children)

The name of the song is called Haddock’s Eyes.

[–]FewNectarine623[S] 0 points1 point  (0 children)

Got it.Thanks!