Python/C API Reference Manual
Previous:
7.2.5.1 Complex Numbers as
Up:
7.2.5 Complex Number Objects
Next:
7.3 Sequence Objects
7.2.5.2 Complex Numbers as Python Objects
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
or a subtype of
PyComplexObject
.
Changed in version 2.2: Allowed subtypes to be accepted.
int
PyComplex_CheckExact
(
PyObject *
p
)
Returns true if its argument is a
PyComplexObject
, but not a subtype of
PyComplexObject
.
New in version 2.2.
PyObject*
PyComplex_FromCComplex
(
Py_complex
v
)
Return value:
New reference.
Create a new Python complex number object from a C
Py_complex
value.
PyObject*
PyComplex_FromDoubles
(
double
real
, double
imag
)
Return value:
New reference.
Returns a new
PyComplexObject
object from
real
and
imag
.
double
PyComplex_RealAsDouble
(
PyObject *
op
)
Returns the real part of
op
as a C
double
.
double
PyComplex_ImagAsDouble
(
PyObject *
op
)
Returns the imaginary part of
op
as a C
double
.
Py_complex
PyComplex_AsCComplex
(
PyObject *
op
)
Returns the
Py_complex
value of the complex number
op
.
Python/C API Reference Manual
Previous:
7.2.5.1 Complex Numbers as
Up:
7.2.5 Complex Number Objects
Next:
7.3 Sequence Objects
Release 2.4, documentation updated on 30 November 2004.
See
About this document...
for information on suggesting changes.