3 ms·
`a=110; b=a` involves only one object: 110. a and b are just names.
by taejo 12y ago
`a=110; b=a` involves only one object: 110. a and b are just names.
- dekhn 12y agoAnd 110 is probably an interned int, so a and b are likely referencing an object that was compiled into the interpreter.
- icebraining 12y agoYeap: >>> a = 110 >>> b = 110 >>> id(a) == id(b) True
- deleted 12y ago[deleted]
- icebraining 12y agoUh, I didn't use assignment between variables; my code is the same as your second example (both variables independently assigned to 110).
- taejo 12y agoIndeed; I was confused by the dekhn's aside.