News for hackers. Stuff that matters.
Re:First Impressions of Python from a Java Developer by reinhardt on Monday November 08, 2010 @07:24PM (#1884709)
Sorry to break it out to you but you picked a bad example; the equivalent Python code has the same WTF effect:

Python 2.6.6 (r266:84292, Oct 17 2010, 15:53:05)

[GCC 4.4.3] on linux2

>>> a = int(10)

>>> b = int(10)

>>> c = int(1000)

>>> d = int(1000)

>>> a is b

True

>>> c is d

False

Re:First Impressions of Python from a Java Developer by Jabbles on Tuesday November 09, 2010 @05:11AM (#1886002)
Wow! Really? (I'm not a Pythonator.)

Same reasoning as Java?

Re:First Impressions of Python from a Java Developer by reinhardt on Tuesday November 09, 2010 @12:49PM (#1887243)
Basically yes, although it is not part of the language definition and should not be relied on. It's just an implementation artifact of CPython, and not only that but the threshold of which integers are cached changes for different Python versions.