all Python 3Arithmetic & operatorsterm
+ addition
arithmetic
The binary addition operator. For numbers it is arithmetic addition; for strings, lists and tuples, concatenation. Sets do not support +: union is spelled |.
Syntax
a + b
There is no implicit conversion: "5" + 1 raises TypeError immediately, and a list cannot be added to a tuple — convert explicitly. For sequences + always builds a new object and copies both operands, so gluing in a loop is quadratic: build strings with "".join() and grow lists with append() or extend().
Examples
print(3 + 5) # → 8
print("Привет" + " " + "мир") # → Привет мир
print([1, 2] + [3, 4]) # → [1, 2, 3, 4]
print(1.5 + 2.5) # → 4.0
print(10 ** 18 + 10 ** 18) # → 2000000000000000000 (big int)
x = 5; print(+x) # → 5 (унарный плюс)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy