Multipel assignment (3)

Equality is commutative and assignment is not

  • mathematics: if a = 7, then 7 = a

  • Python: a = 7 is possible, 7 = a is not possible (think of 7 <- a)

Equality is always true, assignment can change

  • mathematics: if a is equal to b, then b is always equal to a

  • Python: the value of a can change without the value of b being changed

    a = 5
    b = a    # a is assigned to b (a and b are equal)
    a = 3    # 3 is assigned to a (a and b are no longer equal)