Mutable and Immutable objects in Python

Introduction

Function Type and function Id

Mutable objects

Immutable objects

Importance of mutable and immutable objects

NSMALLPOSINTS & NSMALLNEGINTS

  • 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

Sources

--

--

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