Large integer objects are not reused by the interpretor, so you get two distinct objects:
>>> a = 11111
>>> b = 11111
>>> id(a)
40351656
>>> id(b)
40351704
sys.getrefcount(11111) always returns the same number because it measures the reference count of a fresh object.
For small integers, Python always reuses the same object:
>>> sys.getrefcount(1)
73
Usually you would get only one reference to a new object:
>>> sys.getrefcount(object())
1
But integers are allocated in a special pre-malloced area by Python for performance optimization, and I suspect the extra two references have something to do with this.
You can look at the C implementation here: http://svn.python.org/view/python/trunk/Objects/intobject.c?view=markup
Edit: I do not claim to understand what's going on in lowlevel details, I think there are several things at work that cache temporary references:
print sys.getrefcount('foo1111111111111' + 'bar1111111111111') #1
print sys.getrefcount(111111111111 + 2222222222222) #2
print sys.getrefcount('foobar333333333333333333') #3
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…