numbers.Complex

class numbers.Complex[source]

Complex defines the operations that work on the builtin complex type.

In short, those are: a conversion to complex, .real, .imag, +, -, *, /, abs(), .conjugate, ==, and !=.

If it is given heterogenous arguments, and doesn’t have special knowledge about them, it should fall back to the builtin complex type as described below.

Methods

__abs__() Returns the Real distance from 0.
__add__(other) self + other
__complex__() Return a builtin complex instance.
__div__(other) self / other without __future__ division
__eq__(other) self == other
__format__ default object formatter
__mul__(other) self * other
__ne__(other) self != other
__neg__() -self
__new__((S, ...)
__nonzero__() True if self != 0.
__pos__() +self
__pow__(exponent) self**exponent; should promote to float or complex when necessary.
__radd__(other) other + self
__rdiv__(other) other / self without __future__ division
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__rmul__(other) other * self
__rpow__(base) base ** self
__rsub__(other) other - self
__rtruediv__(other) other / self with __future__ division
__sizeof__(() -> int) size of object in memory, in bytes
__sub__(other) self - other
__subclasshook__ Abstract classes can override this to customize issubclass().
__truediv__(other) self / other with __future__ division.
conjugate() (x+y*i).conjugate() returns (x-y*i).

Attributes

imag Retrieve the imaginary component of this number.
real Retrieve the real component of this number.