++ is not an operator. It is two + operators. The + operator is the identity operator, which does nothing. (Clarification: the + and - unary operators only work on numbers, but I presume that you wouldn't expect a hypothetical ++ operator to work on strings.)

++count

Parses as

+(+count)

Which translates to

count

You have to use the slightly longer += operator to do what you want to do:

count += 1

I suspect the ++ and -- operators were left out for consistency and simplicity. I don't know the exact argument Guido van Rossum gave for the decision, but I can imagine a few arguments:

  • Simpler parsing. Technically, parsing ++count is ambiguous, as it could be +, +, count (two unary + operators) just as easily as it could be ++, count (one unary ++ operator). It's not a significant syntactic ambiguity, but it does exist.
  • Simpler language. ++ is nothing more than a synonym for += 1. It was a shorthand invented because C compilers were stupid and didn't know how to optimize a += 1 into the inc instruction most computers have. In this day of optimizing compilers and bytecode interpreted languages, adding operators to a language to allow programmers to optimize their code is usually frowned upon, especially in a language like Python that is designed to be consistent and readable.
  • Confusing side-effects. One common newbie error in languages with ++ operators is mixing up the differences (both in precedence and in return value) between the pre- and post-increment/decrement operators, and Python likes to eliminate language "gotcha"-s. The precedence issues of pre-/post-increment in C are pretty hairy, and incredibly easy to mess up.
Answer from Chris Lutz on Stack Overflow
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ increment-and-decrement-operators-in-python
Increment and Decrement Operators in Python?
August 23, 2023 - Python does not have unary increment/decrement operator (++/--). Instead to increment a value, use to decrement a value, use โˆ’ Python does not provide multiple ways to do the same thing .
๐ŸŒ
Replit
replit.com โ€บ home โ€บ discover โ€บ how to increment a variable in python
How to increment a variable in Python | Replit
February 12, 2026 - The += operator offers a concise way to increment a variable. It combines addition and assignment into a single operation, directly updating the counter's value. This isn't just shorthand for counter = counter + 1โ€”it's the standard, idiomatic ...
Discussions

Behaviour of increment and decrement operators in Python - Stack Overflow
How do I use pre-increment/decrement operators (++, --), just like in C++? Why does ++count run, but not change the value of the variable? More on stackoverflow.com
๐ŸŒ stackoverflow.com
syntax - Python integer incrementing with ++ - Stack Overflow
number++ I can't find anything about this in the Python docs. Must I subject myself to number = number + 1? Don't people use ++ / -- notation? More on stackoverflow.com
๐ŸŒ stackoverflow.com
Increment, decrement... Can we have inc(), dec() functions in Python? feature request :) - Ideas - Discussions on Python.org
hello, Iโ€™ve seen these functions in Pascal ( Inc and Dec - Free Pascal wiki ) Why not in Python? I find them elegant. (Or could a user write these functions by himself? I was trying to do it for myself, but stucked.) Thank you. M. More on discuss.python.org
๐ŸŒ discuss.python.org
0
December 4, 2022
How can I increment i with an additional value within a for loop?
Firstly, the i += 1 part of your code does nothing. Second, the range function can take up to three arguments. When you pass all three, the first is the starting number, the second is the last number (but remember that Python uses half-open intervals), and the last is the step. So you'd do for i in range(0, 4, 2): print(i) More on reddit.com
๐ŸŒ r/learnpython
11
2
May 27, 2022
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ ways-increment-character-python
Ways to increment a character in Python - GeeksforGeeks
February 17, 2023 - One additional approach to incrementing a character in Python is to use the string module's ascii_uppercase or ascii_lowercase constant, depending on the case of the character you want to increment. These constants contain the uppercase or lowercase ASCII letters, respectively, as a string.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ increment and decrement operators in python
Increment and Decrement Operators in Python - Scaler Topics
March 12, 2024 - In Python, the +=1 syntax neatly increments numerical variables, speeding your routines. This straightforward technique improves readability by making your code more expressive and Pythonic.
Top answer
1 of 11
1353

++ is not an operator. It is two + operators. The + operator is the identity operator, which does nothing. (Clarification: the + and - unary operators only work on numbers, but I presume that you wouldn't expect a hypothetical ++ operator to work on strings.)

++count

Parses as

+(+count)

Which translates to

count

You have to use the slightly longer += operator to do what you want to do:

count += 1

I suspect the ++ and -- operators were left out for consistency and simplicity. I don't know the exact argument Guido van Rossum gave for the decision, but I can imagine a few arguments:

  • Simpler parsing. Technically, parsing ++count is ambiguous, as it could be +, +, count (two unary + operators) just as easily as it could be ++, count (one unary ++ operator). It's not a significant syntactic ambiguity, but it does exist.
  • Simpler language. ++ is nothing more than a synonym for += 1. It was a shorthand invented because C compilers were stupid and didn't know how to optimize a += 1 into the inc instruction most computers have. In this day of optimizing compilers and bytecode interpreted languages, adding operators to a language to allow programmers to optimize their code is usually frowned upon, especially in a language like Python that is designed to be consistent and readable.
  • Confusing side-effects. One common newbie error in languages with ++ operators is mixing up the differences (both in precedence and in return value) between the pre- and post-increment/decrement operators, and Python likes to eliminate language "gotcha"-s. The precedence issues of pre-/post-increment in C are pretty hairy, and incredibly easy to mess up.
2 of 11
451

Python does not have pre and post increment operators.

In Python, integers are immutable. That is you can't change them. This is because the integer objects can be used under several names. Try this:

>>> b = 5
>>> a = 5
>>> id(a)
162334512
>>> id(b)
162334512
>>> a is b
True

a and b above are actually the same object. If you incremented a, you would also increment b. That's not what you want. So you have to reassign. Like this:

b = b + 1

Many C programmers who used python wanted an increment operator, but that operator would look like it incremented the object, while it actually reassigns it. Therefore the -= and += operators where added, to be shorter than the b = b + 1, while being clearer and more flexible than b++, so most people will increment with:

b += 1

Which will reassign b to b+1. That is not an increment operator, because it does not increment b, it reassigns it.

In short: Python behaves differently here, because it is not C, and is not a low level wrapper around machine code, but a high-level dynamic language, where increments don't make sense, and also are not as necessary as in C, where you use them every time you have a loop, for example.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ g-fact-21-increment-and-decrement-operators-in-python
Increment += and Decrement -= Assignment Operators in Python - GeeksforGeeks
In this example, a variable x is initialized with the value 5. The += operator is then used to increment the variable by 1, and the result is displayed, showcasing a concise way to perform the increment operation in Python.
Published ย  April 30, 2024
Find elsewhere
๐ŸŒ
The Renegade Coder
therenegadecoder.com โ€บ code โ€บ how-to-increment-a-number-in-python
How to Increment a Number in Python: Operators, Functions, and More โ€“ The Renegade Coder
May 28, 2024 - First, we could use direct assignment: x = x + 1. Alternatively, we could use the condensed increment operator syntax: x += 1. In addition, there are a few less conventional options like using the add method of the operator module or using generator ...
๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ python increment operation
Python Increment Operation - AskPython
January 16, 2024 - Increment operation is used to increase the value of a variable by adding 1 to it. Languages like C, C++, Java, etc. have โ€œ++โ€ for this purpose. If youโ€™re coming from a language where the โ€œ++โ€ operator exists, you may also want to ...
๐ŸŒ
Python.org
discuss.python.org โ€บ ideas
Increment, decrement... Can we have inc(), dec() functions in Python? feature request :) - Ideas - Discussions on Python.org
December 4, 2022 - hello, Iโ€™ve seen these functions in Pascal ( Inc and Dec - Free Pascal wiki ) Why not in Python? I find them elegant. (Or could a user write these functions by himself? I was trying to do it for myself, but stucked.โ€ฆ
๐ŸŒ
Codecademy
codecademy.com โ€บ forum_questions โ€บ 51d6b52d9c4e9d883001800f
++ incrementing doesn't work in Python? | Codecademy
I found that in python you can not use the ++ incrementer on count like you can in almost any other C-based languages.
๐ŸŒ
Codemia
codemia.io โ€บ knowledge-hub โ€บ path โ€บ python_integer_incrementing_with_
Python integer incrementing with ++
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ ways-to-increment-iterator-from-inside-the-for-loop-in-python
Ways to increment Iterator from inside the For loop in Python - GeeksforGeeks
January 22, 2026 - In Python, a for loop iterates over an iterator object rather than using a manual counter. As a result, modifying the loop variable inside the loop does not affect iteration, and controlled stepping must be handled explicitly. Example: Why Incrementing the Loop Variable Does Not Work
๐ŸŒ
Quora
quora.com โ€บ Is-Python-support-an-increment-or-a-decrement-operator
Is Python support an increment or a decrement operator? - Quora
Answer (1 of 3): โ€œIncrement and Decrement Operators in Python.โ€ If you're familiar with Python, you would have known Increment and Decrement operators ( both pre and post) are not allowed in it. Python is designed to be consistent and readable. Now, You must be thinking that โ€œWhy Python doesnโ€™...
๐ŸŒ
GitHub
gist.github.com โ€บ 3083030
Incrementing in python ยท GitHub
Incrementing in python. GitHub Gist: instantly share code, notes, and snippets.
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ learning python โ€บ increment and decrement in python
Increment and Decrement in Python
November 11, 2024 - Python was designed with readability and simplicity in mind, and the creators felt that explicit increments (like i = i + 1) were clearer than the shorthand i++. Python encourages code that is straightforward and easy to understand, even if it means typing a few extra characters.
๐ŸŒ
Runestone Academy
runestone.academy โ€บ ns โ€บ books โ€บ published โ€บ fopp โ€บ SimplePythonData โ€บ UpdatingVariables.html
2.13. Updating Variables โ€” Foundations of Python Programming
If you try to update a variable ... initialize it, usually with a simple assignment. In the above example, x was initialized to 6. Updating a variable by adding something to it is called an increment; subtracting is called a decrement....