Computer Science
An immutable data type is one that cannot change after being created. Give three reasons to use immutable data.
Python Funda
24 Likes
Answer
Three reasons to use immutable data types are:
- Immutable data types increase the efficiency of the program as they are quicker to access than mutable data types.
- Immutable data types helps in efficient use of memory storage as different variables containing the same value can point to the same memory location. Immutability guarantees that contents of the memory location will not change.
- Immutable data types are thread-safe so they make it easier to parallelize the program through multi-threading.
Answered By
15 Likes
Related Questions
What are Immutable and Mutable types in Python? List immutable and mutable types of Python.
What is the difference between implicit type conversion and explicit type conversion?
What is entry controlled loop? Which loop is entry controlled loop in Python?
Explain the use of the pass statement. Illustrate it with an example.