0

I'm having trouble about understanding id in Python3. I always thought holding same value means pointing to same address until i got output like this :

>>> a = 1000
>>> b = 1000
>>> id(a)
140241096743312
>>> id(b)
140241096274640
>>> id(1000)
140241096274800
>>> c = 5
>>> d = 5
>>> id(c)  == id(d)
True

Why am i getting different addresses ? What makes 1000 special or different from 5 so that variables point different addresses ?

vaultah
  • 44,105
  • 12
  • 114
  • 143
Khan9797
  • 600
  • 1
  • 4
  • 12

0 Answers0