1

I know that python interpreter initializes integers from -5 to 256. If I go to the interpreter session, I can achieve this result:

>>> a = 173
>>> b = 173
>>> a is b
True
>>> c = 520
>>> d = 520
>>> c is d
False

But if I write a simple python script and run it:

a = 213
b = 213
print(a is b)

c = 430
d = 430
print(c is d)

the result in both cases is True. Why?

Desiigner
  • 2,136
  • 5
  • 26
  • 47

0 Answers0