Mutable, Immutable… everything is object!

type(object)
type(name, bases, dict)

Input:

Output:

class 'int'
class 'str'
class 'list'

Mutable objects :

Immutable objects :

why does it matter and how differently does Python treat mutable and immutable objects ?

  • Immutable objects are objects that cannot be modified. For example, numbers, strings and tuples are immutable objects.
  • Mutable objects are objects that can be modified. For example, lists and dictionaries are mutable objects.

how arguments are passed to functions and what does that imply for mutable and immutable objects?

--

--

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