Top Description Fields Constructors Methods
org.python.core

public Class PyComplex

extends PyObject
Class Inheritance
Known Direct Subclasses
org.python.core.PyComplexDerived
Annotations
@Untraversable
@ExposedType
name:complex
doc:complex(real[, imag]) -> complex number Create a complex number from a real part and an optional imaginary part. This is equivalent to (real + imag*1j) where imag defaults to 0.
Imports
org.python.core.stringlib.FloatFormatter, .InternalFormat, .InternalFormat.Formatter, .InternalFormat.Spec, org.python.expose.ExposedGet, .ExposedMethod, .ExposedNew, .ExposedType, .MethodType

A builtin python complex number

Field Summary

Modifier and TypeField and Description
public double
public static final PyComplex
pack-priv static PyComplex
J

public static final PyComplex
public double
pack-priv static final InternalFormat.Spec
SPEC_REPR

Format specification used by repr().

pack-priv static final InternalFormat.Spec
SPEC_STR

Format specification used by str() and none-format.

public static final PyType
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
PyComplex(PyType subtype, double r, double i)

public
PyComplex(double r, double i)

public
PyComplex(double r)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__abs__()

Overrides org.python.core.PyObject.__abs__.

Equivalent to the standard Python __abs__ method.

public PyObject
__add__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__add__.

Equivalent to the standard Python __add__ method.

public int
__cmp__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__cmp__.

Equivalent to the standard Python __cmp__ method.

public Object
__coerce_ex__(PyObject
the other object involved in the coercion
other
)

Overrides org.python.core.PyObject.__coerce_ex__.

Implements numeric coercion

public PyComplex
__complex__()

Overrides org.python.core.PyObject.__complex__.

Equivalent to the standard Python __complex__ method.

public PyObject
__div__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__div__.

Equivalent to the standard Python __div__ method

public PyObject
__divmod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__divmod__.

Equivalent to the standard Python __divmod__ method

public PyObject
__eq__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__eq__.

Equivalent to the standard Python __eq__ method.

public PyFloat
__float__()

Overrides org.python.core.PyObject.__float__.

Equivalent to the standard Python __float__ method.

public PyObject
__floordiv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__floordiv__.

Equivalent to the standard Python __floordiv__ method

public PyObject
public PyObject
__ge__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__ge__.

Equivalent to the standard Python __ge__ method.

public PyTuple
public PyObject
__gt__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__gt__.

Equivalent to the standard Python __gt__ method.

public PyObject
__int__()

Overrides org.python.core.PyObject.__int__.

Equivalent to the standard Python __int__ method.

public PyObject
__invert__()

Overrides org.python.core.PyObject.__invert__.

Equivalent to the standard Python __invert__ method.

public PyObject
__le__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__le__.

Equivalent to the standard Python __le__ method.

public PyObject
__long__()

Overrides org.python.core.PyObject.__long__.

Equivalent to the standard Python __long__ method.

public PyObject
__lt__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__lt__.

Equivalent to the standard Python __lt__ method.

public PyObject
__mod__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mod__.

Equivalent to the standard Python __mod__ method

public PyObject
__mul__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__mul__.

Equivalent to the standard Python __mul__ method.

public PyObject
__ne__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__ne__.

Equivalent to the standard Python __ne__ method.

public PyObject
__neg__()

Overrides org.python.core.PyObject.__neg__.

Equivalent to the standard Python __neg__ method.

public boolean
__nonzero__()

Overrides org.python.core.PyObject.__nonzero__.

Equivalent to the standard Python __nonzero__ method.

public PyObject
__pos__()

Overrides org.python.core.PyObject.__pos__.

Equivalent to the standard Python __pos__ method.

public PyObject
__pow__(PyObject
the power to raise this number to.
right
,
PyObject
the modulus to perform this operation in or null if no modulo is to be used
modulo
)

Overrides org.python.core.PyObject.__pow__.

Implements the three argument power function.

public PyObject
__radd__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__radd__.

Equivalent to the standard Python __radd__ method.

public PyObject
__rdiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rdiv__.

Equivalent to the standard Python __rdiv__ method

public PyObject
__rdivmod__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rdivmod__.

Equivalent to the standard Python __rdivmod__ method

public PyString
__repr__()

Overrides org.python.core.PyObject.__repr__.

Equivalent to the standard Python __repr__ method.

public PyObject
__rfloordiv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rfloordiv__.

Equivalent to the standard Python __rfloordiv__ method

public PyObject
__rmod__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmod__.

Equivalent to the standard Python __rmod__ method

public PyObject
__rmul__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rmul__.

Equivalent to the standard Python __rmul__ method.

public PyObject
__rpow__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rpow__.

Equivalent to the standard Python __rpow__ method

public PyObject
__rsub__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rsub__.

Equivalent to the standard Python __rsub__ method

public PyObject
__rtruediv__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rtruediv__.

Equivalent to the standard Python __rtruediv__ method

public PyString
__str__()

Overrides org.python.core.PyObject.__str__.

Equivalent to the standard Python __str__ method.

public PyObject
__sub__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__sub__.

Equivalent to the standard Python __sub__ method

public Object
__tojava__(Class<?>
the Class to convert this PyObject to.
c
)

Overrides org.python.core.PyObject.__tojava__.

Equivalent to the Jython __tojava__ method.

public PyObject
__truediv__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__truediv__.

Equivalent to the standard Python __truediv__ method

private static final PyObject
private static PyObject
_divmod(PyComplex value, PyComplex right)

private static PyObject
_mod(PyComplex value, PyComplex right)

private static final PyObject
public static PyObject
_pow(PyComplex value, PyComplex right)

private static final PyObject
private final boolean
private static int

Returns:

0, 1, or other value for none-format, a float format, or incorrect type.
checkSpecification
(InternalFormat.Spec
a parsed PEP-3101 format specification.
spec
)

Validate a parsed specification, for PyComplex, returning 0 if it is a valid none-format specification, 1 if it is a valid float specification, and some other value if it not a valid type.

private final PyComplex
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
complex___coerce_ex__(PyObject other)

Coercion logic for complex.

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyFloat
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyTuple
pack-priv final PyObject
pack-priv final int
pack-priv final PyInteger
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final boolean
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyComplex
public static PyObject
complex_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

public PyComplex
conjugate()

Overrides org.python.core.PyObject.conjugate.

Equivalent to the standard Python conjugate method.

private int

Returns:

0 = false, 1 = true, 2 = don't know (ask the other object)
eq_helper
(PyObject
to compare for equality with this
other
)

Helper for complex___eq__(PyObject) and complex___ne__(PyObject).

private String

Returns:

formatted value
formatComplex
(InternalFormat.Spec
parsed format specification string
spec
)

Format this complex according to the specification passed in. Supports __str__ and __repr__, and none-format.

public final PyFloat
public final PyFloat
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

private static PyObject
ipow(PyComplex value, int iexp)

public boolean
public static String
toString(double value)

public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

private PyObject
Inherited from org.python.core.PyObject:
__and____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____coerce____contains____delattr____delattr____delete____delitem____delitem____delslice____delslice____dir____ensure_finalizer____findattr____findattr____findattr_ex____finditem____finditem____finditem____get____getattr____getattr____getitem____getitem____getslice____getslice____hash____hex____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____index____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____len____lshift____not____oct____or____pow____rand____rawdir____reduce____reduce_ex____reduce_ex____rlshift____ror____rrshift____rshift____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____trunc____unicode____xor___add_and_basic_add_basic_and_basic_div_basic_divmod_basic_floordiv_basic_iadd_basic_iand_basic_idiv_basic_idivmod_basic_ifloordiv_basic_ilshift_basic_imod_basic_imul_basic_ior_basic_ipow_basic_irshift_basic_isub_basic_itruediv_basic_ixor_basic_lshift_basic_mod_basic_mul_basic_or_basic_pow_basic_rshift_basic_sub_basic_truediv_basic_xor_callextra_cmp_coerce_div_divmod_doget_doget_doset_eq_floordiv_ge_gt_iadd_iand_idiv_idivmod_ifloordiv_ilshift_imod_imul_in_ior_ipow_irshift_is_isnot_isub_itruediv_ixor_jcall_jcallexc_jthrow_le_lshift_lt_mod_mul_ne_notin_or_pow_rshift_sub_truediv_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthdelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisSequenceTypejdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___contains__object___delattr__object___delattr__object___findattr__object___format__object___getattribute__object___hash__object___init__object___new__object___reduce__object___reduce_ex__object___setattr__object___setattr__object___subclasshook__object_toStringproxyInitreadonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage