Digital type of conversion - conversion type and there is no change in the original type id

This is my type of digital learning to whim, in the end the original type conversion type id has not changed?

Not much to say, directly Code

Here I would like to see the original cast of the same type id will not change, the answer is obviously not.

x = 123
print(id(x))    #8791437079184
b = int(x)
print(id(x))    #8791437079184
print(id(b))    #8791437079184

Here is my brain a move, would like to know the type of digital conversion itself is not a direct conversion, the code does not show

float(x)
b = x
print(id(b))    #8791437079184
print(type(b))  #<class 'int'>
print(id(x))    #8791437079184
print(type(x)) #<class 'int'>
print(id(float(x)))    #6205728

Well, now I know this is not it!

 

Guess you like

Origin www.cnblogs.com/Jonepeng/p/11210744.html