DEV Community

Discussion on: Immutable vs Mutable Data Types in Python

schnipdip profile image

Would casting a string to an int still keep the same ID + wouldnt that make the type mutable?

lorrli274 profile image
Lorraine Author

No, they would not have the same ID - take a look at this example in which a string '1' is converted to an integer 1 As you can see, the IDs for the two are different!

Let me know if you have any other questions! :)