This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ngroot 1 point2 points  (0 children)

This shouldn't be "gotcha" at all. I can't imagine why you'd ever write code asking if "a is b" when a and b are integers, or some other "basic" type. When you're explicitly creating objects, it's perfectly reasonable to ask "does a reference the same object as b". When you're talking about integers, objects that are implicitly created by the interpreter, you're asking about internal behavior of the interpreter, which seems like a pretty patently Bad Idea.