0

In python two variable a=10,b=10 then there id(a),id(b) is same but for a=5234,b=5234 id(a),id(b) is different example:

a=12
b=12
print(id(a),id(b))
c=51324344343
d=51324344343
print(id(c),id(d))
wish
  • 67
  • 8
  • https://stackoverflow.com/questions/41885782/why-are-larger-int-numbers-returning-different-and-sometimes-the-same-ids – wish Feb 26 '20 at 08:45
  • Found nice explaination here: http://foobarnbaz.com/2012/07/08/understanding-python-variables/ – wish Feb 27 '20 at 08:45
  • For range -5 to 256 memory location will be same for same value – wish Feb 28 '20 at 11:24

0 Answers0