Table B.3 represents the operators and (built-in and factory) functions that apply to Python's numeric objects.
Operator/built-in
Description
int
long
float
complex
Result[a]
abs()
Absolute value
•
number[a]
chr()
Character
str
coerce()
Numeric coercion
tuple
complex()
Complex factory function
divmod()
Division/modulo
float()
Float factory function
hex()
Hexadecimal string
int()
Int factory function
long()
Long factory function
oct()
Octal string
ord()
Ordinal
(string)
pow()
Exponentiation
number
round()
Float rounding
**[b]
+[c]
No change
-[c]
Negation
~[c]
Bit inversion
int/long
*
Multiplication
/
Classic or true division
//
Floor division
%
Modulo/remainder
+
Addition
-
Subtraction
<<
Bit left shift
>>
Bit right shift
&
Bitwise AND
^
Bitwise XOR
|
Bitwise OR
[a] A result of "number" indicates any of the numeric types, perhaps the same as the operands.
[b] ** has a unique relationship with unary operators; see Section 5.5.3 and Table 5.2.
[c] Unary operator.