Pelokalan
Python ID
id en
Masuk
Proyek
builtins__functions.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
This calls the :meth:`~object.__anext__` method of *async_iterator*, returning an :term:`awaitable`. Awaiting this returns the next value of the iterator. If *default* is given, it is returned if the iterator is exhausted, otherwise :exc:`StopAsyncIteration` is raised.
Convert an integer number to a binary string prefixed with "0b". The result is a valid Python expression. If *integer* is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. Some examples:
Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is converted using the standard :ref:`truth testing procedure <truth>`. If the argument is false or omitted, this returns ``False``; otherwise, it returns ``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`). It cannot be subclassed further. Its only instances are ``False`` and ``True`` (see :ref:`typebool`).
Return :const:`True` if the *object* argument appears callable, :const:`False` if not. If this returns ``True``, it is still possible that a call fails, but if it is ``False``, calling *object* will never succeed. Note that classes are callable (calling a class returns a new instance); instances are callable if their class has a :meth:`~object.__call__` method.
Return the string representing a character with the specified Unicode code point. For example, ``chr(97)`` returns the string ``'a'``, while ``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`.
If all arguments are omitted, returns ``0j``.
Return an enumerate object. *iterable* must be a sequence, an :term:`iterator`, or some other object which supports iteration. The :meth:`~iterator.__next__` method of the iterator returned by :func:`enumerate` returns a tuple containing a count (from *start* which defaults to 0) and the values obtained from iterating over *iterable*.
Kembalikan objek enumerasi. *iterable* harus berupa urutan, sebuah :term:`iterator`, atau objek lain yang mendukung iterasi. The :meth:`~iterator.__next__` metode iterator dikembalikan oleh :func:`enumerate` mengembalikan tuple yang berisi hitungan (dari *start* yang bawaan ke 0) dan nilai yang diperoleh dari mengelilingi *iterable*.
Returns
Kembalian
The default *locals* act as described for function :func:`locals` below. Pass an explicit *locals* dictionary if you need to see effects of the code on *locals* after function :func:`exec` returns.
See :func:`itertools.filterfalse` for the complementary function that returns elements of *iterable* for which *function* is false.
Convert an integer number to a lowercase hexadecimal string prefixed with "0x". If *integer* is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. Some examples:
If the *prompt* argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that. When EOF is read, :exc:`EOFError` is raised. Example::
Jika argumen *prompt* ada, ini ditulis ke keluaran standar tanpa baris tambahan. Fungsi ini kemudian membaca sebuah baris dari masukan, mengubahnya menjadi sebuah string (menghapus baris baru yang tertinggal), dan mengembalikannya. Ketika EOF dibaca, :exc:`EOFError` dimunculkan. Contoh::
If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x.__int__()``. If the argument defines :meth:`~object.__index__`, it returns ``x.__index__()``. For floating-point numbers, this truncates towards zero.
Return ``True`` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or :term:`virtual <abstract base class>`) subclass thereof. If *object* is not an object of the given type, the function always returns ``False``. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a :ref:`types-union` of multiple types, return ``True`` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for an invalid type if an earlier check succeeds.
At module scope, as well as when using :func:`exec` or :func:`eval` with a single namespace, this function returns the same namespace as :func:`globals`.
At class scope, it returns the namespace that will be passed to the metaclass constructor.
When using ``exec()`` or ``eval()`` with separate local and global arguments, it returns the local namespace passed in to the function call.
In an :term:`optimized scope` (including functions, generators, and coroutines), each call to ``locals()`` instead returns a fresh dictionary containing the current bindings of the function's local variables and any nonlocal cell references. In this case, name binding changes made via the returned dict are *not* written back to the corresponding local variables or nonlocal cell references, and assigning, reassigning, or deleting local variables and nonlocal cell references does *not* affect the contents of previously returned dictionaries.
If multiple items are maximal, the function returns the first one encountered. This is consistent with other sort-stability preserving tools such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq.nlargest(1, iterable, key=keyfunc)``.
Jika beberapa item maksimal, fungsi mengembalikan item pertama yang ditemui. Ini konsisten dengan alat pengawet *preserving* sortir yang stabil lain seperti ``sorted(iterable, key=keyfunc, reverse=True)[0]`` dan ``heapq.nlargest(1, iterable, key=keyfunc)``.
If multiple items are minimal, the function returns the first one encountered. This is consistent with other sort-stability preserving tools such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, iterable, key=keyfunc)``.
Jika beberapa item minimal, fungsi mengembalikan item pertama yang ditemui. Ini konsisten dengan alat pengawet *preserving* sortir yang stabil lain seperti ``sorted(iterable, key=keyfunc)[0]`` dan ``heapq.nsmallest(1, iterable, key=keyfunc)``.
This is the ultimate base class of all other classes. It has methods that are common to all instances of Python classes. When the constructor is called, it returns a new featureless object. The constructor does not accept any arguments.
Convert an integer number to an octal string prefixed with "0o". The result is a valid Python expression. If *integer* is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. For example:
"Interactive" text files (files for which :meth:`~io.IOBase.isatty` returns ``True``) use line buffering. Other text files use the policy described above for binary files.
Berkas teks "interactive" (berkas yang :meth:`~io.IOBase.isatty` mengembalikan ``True``) menggunakan *line buffering*. File teks lainnya menggunakan kebijakan yang dijelaskan di atas untuk file biner.
*encoding* is the name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is UTF-8; if :ref:`Python UTF-8 Mode <utf8-mode>` is disabled, the default is platform-dependent (whatever :func:`locale.getencoding` returns). Any :term:`text encoding` supported by Python can be used, and ``encoding="locale"`` specifies the current locale encoding explicitly. See the :mod:`codecs` module for the list of supported encodings.
The type of :term:`file object` returned by the :func:`open` function depends on the mode. When :func:`open` is used to open a file in a text mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used to open a file in a binary mode with buffering, the returned class is a subclass of :class:`io.BufferedIOBase`. The exact class varies: in read binary mode, it returns an :class:`io.BufferedReader`; in write binary and append binary modes, it returns an :class:`io.BufferedWriter`, and in read/write mode, it returns an :class:`io.BufferedRandom`. When buffering is disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned.
Tipe :term:`file object` yang dikembalikan oleh fungsi :func:`open` tergantung pada mode. Ketika :func:`open` digunakan untuk membuka berkas dalam mode teks (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, dll.), ia mengembalikan subkelas dari :class:`io.TextIOBase` (khusus :class:`io.TextIOWrapper`). Ketika digunakan untuk membuka file dalam mode biner dengan *buffering*, kelas yang dikembalikan adalah subkelas dari :class:`io.BufferedIOBase`. Kelas yang tepat bervariasi: dalam mode baca biner, ia mengembalikan :class:`io.BufferedReader`; dalam mode tulis biner dan *append* biner, ia mengembalikan sebuah :class:`io.BufferedWriter`, dan dalam mode baca/tulis, ia mengembalikan sebuah :class:`io.BufferedRandom`. Ketika *buffering* dinonaktifkan, aliran tak diproses *raw stream*, subkelas dari :class:`io.RawIOBase`, :class:`io.FileIO`, dikembalikan.
If the argument is a one-character string, return the Unicode code point of that character. For example, ``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:`chr`.
If the argument is a :class:`bytes` or :class:`bytearray` object of length 1, return its single byte value. For example, ``ord(b'a')`` returns the integer ``97``.
When arguments are builtin numeric types with mixed operand types, the coercion rules for binary arithmetic operators apply. For :class:`int` operands, the result has the same type as the operands (after coercion) unless the second argument is negative; in that case, all arguments are converted to float and a float result is delivered. For example, ``pow(10, 2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of type :class:`int` or :class:`float` and a non-integral exponent, a complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:`float` with an integral exponent, a float result is delivered. For example, ``pow(-9, 2.0)`` returns ``81.0``.
Return a string containing a printable representation of an object. For many types, this function makes an attempt to return a string that would yield an object with the same value when passed to :func:`eval`; otherwise, the representation is a string enclosed in angle brackets that contains the name of the type of the object together with additional information often including the name and address of the object. A class can control what this function returns for its instances by defining a :meth:`~object.__repr__` method.
Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is ``None``, it returns the nearest integer to its input.
Kembalikan *number* dibulatkan ke *ndigits* presisi setelah titik desimal. Jika *ndigits* dihilangkan atau ``None``, ini akan mengembalikan integer terdekat ke masukannya.
See :func:`itertools.islice` for an alternate version that returns an :term:`iterator`.
Sums *start* and the items of an *iterable* from left to right and returns the total. The *iterable*'s items are normally numbers, and the start value is not allowed to be a string.
Jumlah *start* dan item dari *iterable* dari kiri ke kanan dan mengembalikan total. Item *iterable* biasanya berupa angka, dan nilai awal tidak boleh berupa string.
More formally: :func:`zip` returns an iterator of tuples, where the *i*-th tuple contains the *i*-th element from each of the argument iterables.
Edge cases: With a single iterable argument, :func:`zip` returns an iterator of 1-tuples. With no arguments, it returns an empty iterator.
Note how :func:`__import__` returns the toplevel module here because this is the object that is bound to a name by the :keyword:`import` statement.
Perhatikan caranya :func:`__import__` mengembalikan modul tingkat atas di sini karena ini adalah objek yang terikat pada nama oleh pernyataan :keyword:`import`.