7.4.4 Complex Number Objects

Py_complex
The C structure which corresponds to the value portion of a Python complex number object. Most of the functions for dealing with complex number objects use structures of this type as input or output values, as appropriate. It is defined as:

typedef struct {
   double real;
   double imag;
} Py_complex;

PyComplexObject
This subtype of PyObject represents a Python complex number object.

PyTypeObject PyComplex_Type
This instance of PyTypeObject represents the Python complex number type.

int PyComplex_Check(PyObject *p)
Returns true if its argument is a PyComplexObject.

Py_complex _Py_c_sum(Py_complex left, Py_complex right)

Py_complex _Py_c_diff(Py_complex left, Py_complex right)

Py_complex _Py_c_neg(Py_complex complex)

Py_complex _Py_c_prod(Py_complex left, Py_complex right)

Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)

Py_complex _Py_c_pow(Py_complex num, Py_complex exp)

PyObject* PyComplex_FromCComplex(Py_complex v)

PyObject* PyComplex_FromDoubles(double real, double imag)

double PyComplex_RealAsDouble(PyObject *op)

double PyComplex_ImagAsDouble(PyObject *op)

Py_complex PyComplex_AsCComplex(PyObject *op)

guido@python.org