Mutable And Immutable types in python?
1) Everything in python 3 objects. So Every object has Id, type and value and id uniquely identifies an object and it can not change throughout life of object
2) Also, type identifies a class of an object and also it cannot change throughout the life of an object.
3) Values are the content of the object.
4) Most Fundamental types in python are immutable -number, string, tuples
5) Mutable object change value but immutable may not you can verify this by using id method so if it is changed then it is immutable or if not then it’s mutable.
2) Also, type identifies a class of an object and also it cannot change throughout the life of an object.
3) Values are the content of the object.
4) Most Fundamental types in python are immutable -number, string, tuples
5) Mutable object change value but immutable may not you can verify this by using id method so if it is changed then it is immutable or if not then it’s mutable.
Comments
Post a Comment