Top Description Fields Constructors Methods
org.python.core

public Class PyLong

extends PyObject
Class Inheritance
Known Direct Subclasses
org.python.core.PyLongDerived
Annotations
@Untraversable
@ExposedType
name:long
doc:long(x[, base]) -> integer Convert a string or number to a long integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string.
Imports
java.io.Serializable, java.math.BigDecimal, .BigInteger, org.python.core.stringlib.FloatFormatter, .IntegerFormatter, .InternalFormat, .InternalFormat.Formatter, .InternalFormat.Spec, org.python.expose.ExposedGet, .ExposedMethod, .ExposedNew, .ExposedType, .MethodType

A builtin python long. This is implemented as a java.math.BigInteger.

Field Summary

Modifier and TypeField and Description
public static final BigInteger
public static final BigInteger
public static final BigInteger
maxLong

Deprecated Use MAX_INT instead.
public static final BigInteger
maxULong

Deprecated Use MAX_ULONG instead.
public static final BigInteger
public static final BigInteger
minLong

Deprecated Use MIN_INT instead.
public static final PyType
private final BigInteger
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
PyLong(PyType subType, BigInteger v)

public
public
PyLong(double v)

public
PyLong(long v)

public

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 PyObject
__and__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__and__.

Equivalent to the standard Python __and__ 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 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 PyTuple
public PyString
__hex__()

Overrides org.python.core.PyObject.__hex__.

Equivalent to the standard Python __hex__ method Should only be overridden by numeric objects that can be reasonably represented as a hexadecimal string.

public PyObject
__index__()

Overrides org.python.core.PyObject.__index__.

Equivalent to the standard Python __index__ 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
__long__()

Overrides org.python.core.PyObject.__long__.

Equivalent to the standard Python __long__ method.

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

Overrides org.python.core.PyObject.__lshift__.

Equivalent to the standard Python __lshift__ 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
__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 PyString
__oct__()

Overrides org.python.core.PyObject.__oct__.

Equivalent to the standard Python __oct__ method.

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

Overrides org.python.core.PyObject.__or__.

Equivalent to the standard Python __or__ 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
__rand__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rand__.

Equivalent to the standard Python __rand__ 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 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
__ror__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__ror__.

Equivalent to the standard Python __ror__ 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
__rshift__(PyObject
the object to perform this binary operation with (the right-hand operand).
right
)

Overrides org.python.core.PyObject.__rshift__.

Equivalent to the standard Python __rshift__ 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 PyObject
__rxor__(PyObject
the object to perform this binary operation with (the left-hand operand).
left
)

Overrides org.python.core.PyObject.__rxor__.

Equivalent to the standard Python __rxor__ 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

public PyObject
__trunc__()

Overrides org.python.core.PyObject.__trunc__.

Equivalent to the standard Python __trunc__ method.

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

Overrides org.python.core.PyObject.__xor__.

Equivalent to the standard Python __xor__ method

public static PyObject
_pow(BigInteger value, BigInteger y, PyObject modulo, PyObject left, PyObject right)

public int
asIndex(PyObject
the Python exception to raise on OverflowErrors
err
)

Overrides org.python.core.PyObject.asIndex.

Convert this object into an index-sized integer.

public int
public int
asInt()

Overrides org.python.core.PyObject.asInt.

Convert this object into an int.

public long
public long
asLong()

Overrides org.python.core.PyObject.asLong.

Convert this object into a long.

private static PyObject

Returns:

convert to a long.
asPyLong
(PyObject x)

public int
bit_length()

Overrides org.python.core.PyObject.bit_length.

Equivalent to the standard Python bit_length method.

private static final boolean
private static final BigInteger
private static final int
public PyObject
conjugate()

Overrides org.python.core.PyObject.conjugate.

Equivalent to the standard Python conjugate method.

private static PyObject

Returns:

convert to an int.
convertIntegralToLong
(PyObject integral)

private BigInteger
public double
private PyString

Returns:

converted value of this object
formatImpl
(InternalFormat.Spec
prepared format-specifier.
spec
)

Common code used by the number-base conversion method __oct__ and __hex__.

public PyObject
public PyObject
public long
getLong(long min, long max)

public long
getLong(long min, long max, String overflowMsg)

public PyObject
public PyObject
public BigInteger
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

public boolean
isIndex()

Overrides org.python.core.PyObject.isIndex.

Determine if this object can act as an index (implements __index__).

public boolean
public boolean
public boolean
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final Object
long___coerce_ex__(PyObject other)

Coercion logic for long.

pack-priv final PyComplex
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyFloat
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyTuple
pack-priv final int
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 PyObject
pack-priv final PyObject
public static PyObject
long___new__(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

public boolean
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 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 PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
public PyString
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final String
private static PyObject
longSubtypeNew(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

Wimpy, slow approach to new calls for subtypes of long.

private BigInteger
private static final double
scaledDoubleValue(BigInteger val, int[] exp)

public double
scaledDoubleValue(int[] exp)

private static BigInteger
toBigInteger(double value)

Convert a double to BigInteger, raising an OverflowError if infinite.

public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

private static final PyFloat
Inherited from org.python.core.PyObject:
__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____eq____findattr____findattr____findattr_ex____finditem____finditem____finditem____ge____get____getattr____getattr____getitem____getitem____getslice____getslice____gt____hash____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____le____len____lt____ne____not____pow____rawdir____reduce____reduce_ex____reduce_ex____repr____rlshift____rrshift____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice___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_xoradaptToCoerceTupleasDoubleasIndexasIterableasNameasNameasStringasStringasStringOrNullasStringOrNulldelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIntegerjdontdelmergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___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