On this page
numbers.Complex
Up: numbers | Next: numbers.Integral
Rel: numbers.Integral, numbers.Number, numbers.Rational, numbers.Real
Ref: docs.python.org — numbers.Complex
Tags: #public #python3 #stdlib #numbers
Import
import numbers
from numbers import Complex
Signature & Overview
numbers.Complex()
Complex defines the operations that work on the builtin complex type.
Methods & Attributes
Complex.conjugate(self)— (x+yi).conjugate() returns (x-yi).Complex.imag(...)— Retrieve the imaginary component of this number.Complex.real(...)— Retrieve the real component of this number.
Usage
import numbers
assert isinstance(3 + 4j, numbers.Complex)
assert isinstance(5, numbers.Complex) # Integral < Rational < Real < Complex
Gotchas
- Numeric tower:
intis an instance ofIntegral,Rational,Real, andComplex, whereasDecimalis not registered underReal.
REPL Inspect
from numbers import Complex
help(Complex)
Linked from
Related notes
- tuts/python3/stdlib_module/numbers/Integral Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Number Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Rational Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Real Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib