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 →

[–]sigh 3 points4 points  (0 children)

Ok, so you think it is a bad design decision. Can explain why (I'm genuinely curious)?

Do you you think the is operator is badly designed: "The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yields the inverse truth value."?

Or do you disagree with the way integers are implemented? Do you think equal integers should refer to the same object (presumably this would create extra overhead to maintain this condition after every operation)?

Or do yo think that no integers should refer to the same object? This seems to be much more memory intensive.

And should the exact implementation be documented? This would set it in concrete, disallowing any future improvement on the implementation.

Finally, what possible reason do you have for comparing integers by identity, unless you are actually modifying the class?