Operators
+ — Addition and concatenation
Adds compatible numbers or joins compatible sequences. Built-in mixed numeric arithmetic promotes to a suitable common numeric type; list concatenation creates a new outer list without copying nested items. __add__ and __radd__ implement custom behavior; a more specific right-hand subclass can receive priority. Returning NotImplemented lets dispatch consider another implementation. Unlike +=, ordinary + does not request in-place addition. Multiplication binds more tightly than addition. For operands of the same type, a declined forward operation does not trigger the reflected method; unsupported arithmetic normally raises TypeError.
Formal Syntax & Structure
python syntaxpython
left + rightParameters & Attributes
| Name | Type | Description |
|---|---|---|
| left | number, supported sequence or custom object | Number or sequence to extend by addition. |
| right | number, supported sequence or custom object | Compatible numeric value or sequence of the same kind. |
Return Value
object
Result selected by the operand types and their operation implementations.
Working Example
Example Snippetpython
print(12 + 7)print(2 + 0.5)print([1, 2] + [3])