Python’s complex number objects are implemented as two distinct types whenviewed from the C API: one is the Python object exposed to Python programs, andthe other is a C structure which represents the actual complex number value.The API provides functions for working with both.
Note that the functions which accept these structures as parameters and returnthem as results do soby value rather than dereferencing them throughpointers. This is consistent throughout the API.
The C structure which corresponds to the value portion of a Python complexnumber object. Most of the functions for dealing with complex number objectsuse structures of this type as input or output values, as appropriate. It isdefined as:
typedefstruct{doublereal;doubleimag;}Py_complex;
Return the sum of two complex numbers, using the CPy_complexrepresentation.
Return the difference between two complex numbers, using the CPy_complex representation.
Return the negation of the complex numbercomplex, using the CPy_complex representation.
Return the product of two complex numbers, using the CPy_complexrepresentation.
Return the quotient of two complex numbers, using the CPy_complexrepresentation.
Ifdivisor is null, this method returns zero and setserrno toEDOM.
Return the exponentiation ofnum byexp, using the CPy_complexrepresentation.
Ifnum is null andexp is not a positive real number,this method returns zero and setserrno toEDOM.
This instance ofPyTypeObject represents the Python complex numbertype. It is the same object ascomplex in the Python layer.
Return true if its argument is aPyComplexObject or a subtype ofPyComplexObject.
Return true if its argument is aPyComplexObject, but not a subtype ofPyComplexObject.
Create a new Python complex number object from a CPy_complex value.
Return a newPyComplexObject object fromreal andimag.
Return thePy_complex value of the complex numberop.
Ifop is not a Python complex number object but has a__complex__()method, this method will first be called to convertop to a Python complexnumber object. Upon failure, this method returns-1.0 as a real value.
Enter search terms or a module, class or function name.