Q. An immutable data type is one that cannot change after being created. Give three reasons to use immutable data.


Answer =

1. To Increase efficiency of the Program :- for example Tuple load faster than list.

2. It will never modify, so we can use it in our whole program without any fear.

3. Immutable objects are thread safe. The state of an object cannot be changed after its construction. This implies that read-only data is shared among threads, which provides thread safety. Operations involving mutations like (changing value at a particular index) can be implemented in such a way that they create new objects instead of modifying the existing ones.

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post