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:

  1. Immutable data types increase the efficiency of the program as they are quicker to access than mutable data types.
  2. 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.
  3. Immutable data types are thread-safe so they make it easier to parallelize the program through multi-threading.

Answered By

15 Likes


Related Questions