Mutable Functions

  • functions with behavior that changes over time

  • oposite of a "pure" or "deterministic" function

NONLOCAL

  • mutable values can be changed without a nonlocal statement (b[0] = new_value)

  • modify a binding in a parent frame instead of just looking it up

  • a variable declared nonlocal must:

    • exist in a parent frame

    • not exist in the current frame

Last updated