Mutable and Immutable objects in Python


Function Type and function Id

Mutable objects

Immutable objects

Importance of mutable and immutable objects


  • Strings without whitespaces and less than 20 characters
  • Integers between -5 to 256 (including both as explained above)
  • Empty immutable objects (tuples)
  • Since programmers use these objects frequently, interning existing objects saves memory.
  • Since immutable objects like tuples and strings cannot be modified, there is no risk in interning the same object.

Frozen sets

How arguments are passed to functions




Mechanical Engineer learning software development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store