News for hackers. Stuff that matters.
Re:Facts and myths about Python names and values by nslocum on Sunday July 14, 2013 @12:55PM (#6041354)
You're correct.

Further, there are some odd quirks because of the way Python caches small Integers for efficiency.

  > 2 + 2 is 4
  True
  > 1000 + 1 is 1001
  False
Re:Facts and myths about Python names and values by audeyisaacs on Sunday July 14, 2013 @02:04PM (#6041576)
Re:Facts and myths about Python names and values by nslocum on Sunday July 14, 2013 @02:27PM (#6041660)
After a little trial and error, it appears that Python caches the values in range(-5,257).

  > -6 + 0 is -6
  False
  > -5 + 0 is -5
  True
  > 256 + 0 is 256
  True
  > 257 + 0 is 257
  False
Re:Facts and myths about Python names and values by wahnfrieden on Sunday July 14, 2013 @04:43PM (#6042166)
(CPython)
Re:Facts and myths about Python names and values by Thrymr on Sunday July 14, 2013 @01:11PM (#6041402)

    > 2 + 4 is 4
    True
I sure hope not.
Re:Facts and myths about Python names and values by nslocum on Sunday July 14, 2013 @02:21PM (#6041629)
lol, thanks, i fixed it
Re:Facts and myths about Python names and values by alecrn on Sunday July 14, 2013 @01:12PM (#6041403)
(I think you meant 2 + 2 is 4)