Pelokalan
Python ID
id en
Masuk
Proyek
c-api__long.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
Integer Objects
All integers are implemented as "long" integer objects of arbitrary size.
This subtype of :c:type:`PyObject` represents a Python integer object.
This instance of :c:type:`PyTypeObject` represents the Python integer type. This is the same object as :class:`int` in the Python layer.
Return true if its argument is a :c:type:`PyLongObject` or a subtype of :c:type:`PyLongObject`. This function always succeeds.
Return true if its argument is a :c:type:`PyLongObject`, but not a subtype of :c:type:`PyLongObject`. This function always succeeds.
Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure.
CPython keeps an array of integer objects for all integers between ``-5`` and ``1024``. When you create an int in that range you actually just get back a reference to the existing object.
Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long`, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` object from a C :c:expr:`long long`, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long long`, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure.
Return a new :c:type:`PyLongObject` object from an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception set on failure.
Return a new :c:type:`PyLongObject` object from the integer part of *v*, or ``NULL`` on failure.
Return a new :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*, or ``NULL`` on failure. If *pend* is non-``NULL``, *\*pend* will point to the end of *str* on success or to the first character that could not be processed on error. If *base* is ``0``, *str* is interpreted using the :ref:`integers` definition; in this case, leading zeros in a non-zero decimal number raises a :exc:`ValueError`. If *base* is not ``0``, it must be between ``2`` and ``36``, inclusive. Leading and trailing whitespace and single underscores after a base specifier and between digits are ignored. If there are no digits or *str* is not NULL-terminated following the digits and trailing whitespace, :exc:`ValueError` will be raised.
:c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` functions can be used to convert a :c:type:`PyLongObject` to/from an array of bytes in base ``256``.
Return a C :c:expr:`long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`.
Use :meth:`~object.__index__` if available.
Gunakan :meth:`~object.__index__` jika tersedia.
This function will no longer use :meth:`~object.__int__`.
Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`.
Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`.
Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`.
Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`.
Return a C :c:expr:`unsigned long long` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`.
Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`.
Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`.
If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`.
Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`.
If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is passed, its :meth:`~object.__index__` method will be called first. This may result in Python code executing and other threads being allowed to run, which could cause changes to other objects or values in use. When *flags* is ``-1``, this option is not set, and non-integer values will raise :exc:`TypeError`.
Get the sign of the integer object *obj*.
On failure, return -1 with an exception set. This function always succeeds if *obj* is a :c:type:`PyLongObject` or its subtype.
Check if the integer object *obj* is positive (``obj > 0``).
If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's positive and ``0`` otherwise. Else set an exception and return ``-1``.
Check if the integer object *obj* is negative (``obj < 0``).
If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's negative and ``0`` otherwise. Else set an exception and return ``-1``.
Check if the integer object *obj* is zero.
If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's zero and ``0`` otherwise. Else set an exception and return ``-1``.
Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :class:`int` objects, used internally for integers with "big enough" absolute value.
Get the native layout of Python :class:`int` objects.
Export of a Python :class:`int` object.
The native integer value of the exported :class:`int` object. Only valid if :c:member:`digits` is ``NULL``.
Export a Python :class:`int` object.
This function always succeeds if *obj* is a Python :class:`int` object or a subclass.
Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer instance without creating an :class:`~int` object.
On success, return a Python :class:`int` object. On error, set an exception and return ``NULL``.
The function takes care of normalizing the digits and converts the object to a compact integer if needed.
These macros are :term:`soft deprecated`. They describe parameters of the internal representation of :c:type:`PyLongObject` instances.
object
objek