✨ What Does += Actually Do?
Understanding Python's += operator and how it makes updating variables simpler and easier to read.
Sep 24, 2026 • 8:28 PM • 4 min read
All dates and times are in CT
What Does += Actually Do?
One of the Python operators I started seeing everywhere was +=.
At first, it looked a little strange.
I understood what + meant, and I understood that = was used for assignment, but putting them together made me wonder what they actually did.
Eventually, I learned that += is a shortcut for updating a variable using addition. Python calls this an augmented assignment operator. (docs.python.org)
The Basic Idea
Suppose I have a variable containing a number.
If I want to add something to that number and store the new value back in the same variable, I could write the longer version:
x = x + 5
But Python also lets me write:
x += 5
These two forms have essentially the same purpose for a simple numeric variable. (docs.python.org)
The second version is shorter and easier to read.
Thinking of It as an Update
The easiest way I remember += is:
"Take the current value and add this to it."
If a variable starts at 10 and I use += 3, the variable becomes 13.
If I use += 7 again, it becomes 20.
The variable keeps its current value and updates it.
That makes += especially useful when a value changes repeatedly.
Why Is It Useful in Loops?
This is where += became especially useful for me.
Loops often need a variable that changes after every iteration.
For example, I might have a counter that needs to increase each time the loop runs.
Instead of writing the longer assignment every time, I can use +=.
That makes the code shorter and makes the purpose of the line easier to understand.
When I see something like count += 1, I immediately know that the counter is increasing by one.
It Doesn't Only Work With Numbers
+= isn't limited to adding numbers.
Python's augmented assignment operators work according to the type of the objects involved. For example, += can also be used with strings to build a larger string. (docs.python.org)
That means the same operator can be useful in different situations.
The important idea is that the operation happens and the result is assigned back to the target.
Other Operators Work This Way Too
+= is part of a larger group of augmented assignment operators.
Python also supports operators such as:
* -=
=
* /=
* //=
* %=
*=
These follow the same general idea.
For example, x -= 2 updates x by subtracting 2.
So once I understand +=, several other operators become easier to understand too.
A Small Shortcut With a Big Effect
At first, += might not seem like a huge deal.
It's only a few characters shorter than writing the longer version.
But when code gets larger, small improvements like this can make a difference.
If I have a loop that updates a variable hundreds of times, using a simple and readable operator makes the code easier to follow.
Good code isn't always about doing something complicated.
Sometimes it's about expressing a simple idea clearly.
Why I Like +=
I like += because it represents something I do in programming all the time:
Take what I already have and build on it.
That could mean increasing a counter, adding numbers to a total, or adding more text to a string.
Once I understood that idea, += stopped looking like a strange combination of symbols.
It became a simple tool for updating information.
Reflection
Learning += helped me understand that Python has many shortcuts designed to make common operations easier to write.
It's a small operator, but I use it often when working with loops and changing variables.
The most important thing is remembering what it means:
Take the current value, perform the operation, and store the updated result.
That simple idea shows up in a lot of programs.
Sometimes a few characters can make a program much easier to understand.
Feedback
Was this article useful?
Discussion