loading...

Discussion on: Immutable vs Mutable Data Types in Python

Collapse
schnipdip profile image
schnipdip

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

Collapse
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 next.tech/projects/e7c86bfc750b/share. As you can see, the IDs for the two are different!

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