Notes

  • The official Python term is augmented assignment, but it goes by a few other names depending on context:
  • Augmented assignment operator — the term used in the Python language reference
  • Compound assignment operator — a more general programming-languages term (used across C, Java, JavaScript, etc.)
  • In-place operator — sometimes used because for mutable objects, += can modify the object in place (via __iadd__) rather than creating a new one, unlike count = count + 1

So if you see any of these terms — augmented assignment, compound assignment, or in-place assignment — they’re all referring to the same +=, -=, *=, etc. family of operators.

The “in-place” distinction is actually the most technically interesting one: for immutable types like int, count += 1 behaves identically to count = count + 1 (a new object is created). But for mutable types like list, some_list += [1] can behave differently from some_list = some_list + [1], because the former may mutate the original list object rather than creating a new one.

REPL

❯ uv run python
Python 3.14.3 (main, Feb  3 2026, 15:32:20) [Clang 17.0.0 (clang-1700.6.3.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 4 / 2
2.0
>>> 7 / 2
3.5
>>> 4 % 2
0
>>> 7 % 2
1
>>> 7 // 2
3
>>> 7 // 4
1
>>> 7 5 4
  File "<python-input-6>", line 1
    7 5 4
      ^
SyntaxError: invalid syntax
>>> 7 %  4
3
>>> 7 / 3
2.3333333333333335
>>> 7 // 3
2
>>> 7 % 3
1
>>> 1 + 2
3
>>> 1 5 2
  File "<python-input-12>", line 1
    1 5 2
      ^
SyntaxError: invalid syntax
>>> 1 % 2
1
>>> 3 % 2
1
>>> 3 + 2
5
>>> 5 % 2
1
>>>
>>> number = 5
>>> number *= 3 # number = number * 3
>>> number
15
>>> number * = 4
  File "<python-input-20>", line 1
    number * = 4
             ^
SyntaxError: invalid syntax
>>> number *= 4
>>> number
60
>>> number/= 11
>>> # number =  60 / 11
>>> number
5.454545454545454
>>> number **= 3
>>> number
162.28399699474076
>>> another_number = 17
>>> another_number %= 2
>>> another_number
1
>>> another_number = 16
>>> another_number %= 2
>>> another_number
0
>>>

Code