4 ms·
I don't think the author meant to imply that "is" is equivalent to equality. I think the author was specifically trying to check the references to see where pyt
by thethirdone 9y ago
I don't think the author meant to imply that "is" is equivalent to equality. I think the author was specifically trying to check the references to see where python stops coalescing integers.
- c3534l 9y agoI guess, but then it's also kind of uninteresting. Lists in Python are an array of pointers. That Python implements assignment differently is kind of an odd detail, but altering the value of one of the variables doesn't alter the value of the other. It's just sort of an under-the-hood implementation detail visible only through Python's introspection tools, not something that actually affects code. I tried it myself: a, b = [1, 1] a = 2 print(a is b) and got an output of false.
- yorwba 9y agoThe point is that is is making those implementation details visible. That is absolutely going to affect code relying on those details. It won't affect good code, of course, but everyone writes stupid code in a while, and if it appears to work, nobody will fix it.
- deleted 9y ago[deleted]