Source: https://docs.google.com/presentation/d/1mtteVCTAWWZpq-R9y-KjGJj6IOo_5sRb/edit#slide=id.p1

Mutable Data

Mutability

  • Immutable: the value of the object cannot be changed
    • Integers, floats, booleans
    • Strings, tuples
  • Mutable: the value of the object can be changed:
    • Lists
    • Dictionaries

Mutation can happen within a function call

A function can change the value of any object within its scope

From Value to Storage

  • A variable assigned a compound value (object) is a reference (memory address) to that object
  • Mutable objects can be changed but the variable(s) still refer to it