addressof object with id()

Fabian von Romberg fromberg100 at hotmail.com
Sun Mar 24 01:37:35 CET 2013


Hi,

I have a single questions regarding id() built-in function.

example 1:

var1 = "some string"
var2 = "some string"

if use the id() function on both, it returns exactly the same address.


example 2:

data = "some string"
var1 = data
var2 = data

if use the id() function on var1 and var2, it returns exactly the same address.


can anyone explain me please why does this happens?   Is this correct?


Thanks in advance and regards,
Fabian




More information about the Python-list mailing list