Re:Why Python is Slow: Looking Under the Hood
by taejo on Friday May 09, 2014 @12:45PM
(#7721825)
`a=110; b=a` involves only one object: 110. a and b are just names.
[ Parent
| on HN ]
And 110 is probably an interned int, so a and b are likely referencing an object that was compiled into the interpreter.
Re:Why Python is Slow: Looking Under the Hood
by icebraining on Friday May 09, 2014 @12:57PM
(#7721883)
Yeap:
>>> a = 110
>>> b = 110
>>> id(a) == id(b)
True[deleted]
Re:Why Python is Slow: Looking Under the Hood
by icebraining on Friday May 09, 2014 @01:40PM
(#7722170)
Uh, I didn't use assignment between variables; my code is the same as your second example (both variables independently assigned to 110).