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.
The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). :exc:`ValueError` will be raised if it is outside that range.
Raises an :ref:`auditing event <auditing>` ``compile`` with arguments ``source`` and ``filename``. This event may also be raised by implicit compilation.
Memunculkan :ref:`auditing event <auditing>` ``compile`` dengan argumen ``source`` dan ``filename``. *event* ini juga dapat dimunculkan oleh kompilasi implisit.
Previously, :exc:`TypeError` was raised when null bytes were encountered in *source*.
Sebelumnya, :exc:`TypeError` dimunculkan ketika byte *null* ditemui di *source*.
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes are encountered in *source*.
Raises an :ref:`auditing event <auditing>` ``exec`` with the code object as the argument. Code compilation events may also be raised.
Memunculkan :ref:`auditing event <auditing>` ``exec`` dengan objek kode sebagai argumen. Kompilasi kode *events* juga dapat dimunculkan.
Otherwise, if the argument is an integer or a floating-point number, a floating-point number with the same value (within Python's floating-point precision) is returned. If the argument is outside the range of a Python float, an :exc:`OverflowError` will be raised.
A call to ``format(value, format_spec)`` is translated to ``type(value).__format__(value, format_spec)`` which bypasses the instance dictionary when searching for the value's :meth:`~object.__format__` method. A :exc:`TypeError` exception is raised if the method search reaches :mod:`object` and the *format_spec* is non-empty, or if either the *format_spec* or the return value are not strings.
Return the value of the named attribute of *object*. *name* must be a string. If the string is the name of one of the object's attributes, the result is the value of that attribute. For example, ``getattr(x, 'foobar')`` is equivalent to ``x.foobar``. If the named attribute does not exist, *default* is returned if provided, otherwise :exc:`AttributeError` is raised. *name* need not be a Python identifier (see :func:`setattr`).
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::
:class:`int` string inputs and string representations can be limited to help avoid denial of service attacks. A :exc:`ValueError` is raised when the limit is exceeded while converting a string to an :class:`int` or when converting an :class:`int` into a string would exceed the limit. See the :ref:`integer string conversion length limitation <int_max_str_digits>` documentation.
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.
Return ``True`` if *cls* is a subclass (direct, indirect, or :term:`virtual <abstract base class>`) of *classinfo*. A class is considered a subclass of itself. *classinfo* may be a tuple of class objects (or recursively, other such tuples) or a :ref:`types-union`, in which case return ``True`` if *cls* is a subclass of any entry in *classinfo*. In any other case, a :exc:`TypeError` exception is raised.
Return an :term:`iterator` object. The first argument is interpreted very differently depending on the presence of the second argument. Without a second argument, the single argument must be a collection object which supports the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must support the sequence protocol (the :meth:`~object.__getitem__` method with integer arguments starting at ``0``). If it does not support either of those protocols, :exc:`TypeError` is raised. If the second argument, *sentinel*, is given, then the first argument must be a callable object. The iterator created in this case will call *callable* with no arguments for each call to its :meth:`~iterator.__next__` method; if the value returned is equal to *sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be returned.
Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterables* arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is :term:`exhausted`. If *strict* is ``True`` and one of the iterables is exhausted before the others, a :exc:`ValueError` is raised. For cases where the function inputs are already arranged into argument tuples, see :func:`itertools.starmap`.
There are two optional keyword-only arguments. The *key* argument specifies a one-argument ordering function like that used for :meth:`list.sort`. The *default* argument specifies an object to return if the provided iterable is empty. If the iterable is empty and *default* is not provided, a :exc:`ValueError` is raised.
Ada dua opsional hanya argumen kata kunci *keyword arguments*. Argumen *key* menentukan fungsi pengurutan satu argumen seperti yang digunakan untuk :meth:`list.sort`. Argumen *default* menentukan objek yang akan dikembalikan jika yang disediakan itu kosong. Jika iterable kosong dan *default* tidak disediakan, :exc:`ValueError` akan dimunculkan.
Retrieve the next item from the :term:`iterator` by calling its :meth:`~iterator.__next__` method. If *default* is given, it is returned if the iterator is :term:`exhausted`, otherwise :exc:`StopIteration` is raised.
Open *file* and return a corresponding :term:`file object`. If the file cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more examples of how to use this function.
Buka *file* dan mengembalikan yang sesuai dengan :term:`file object`. Jika file tersebut tidak dapat dibuka, sebuah :exc:`OSError` akan dinaikkan. Lihat :ref:`tut-files` untuk contoh yang lebih banyak terkait bagaimana menggunakan fungsi ini.
If *closefd* is ``False`` and a file descriptor rather than a filename was given, the underlying file descriptor will be kept open when the file is closed. If a filename is given *closefd* must be ``True`` (the default); otherwise, an error will be raised.
:exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`.
:exc:`IOError` sebelumnya ditimbulkan, sekarang merupakan alias dari :exc:`OSError`.
:exc:`FileExistsError` is now raised if the file opened in exclusive creation mode (``'x'``) already exists.
:exc:`FileExistsError` sekarang ditimbulkan jika berkas yang dibuka dalam mode pembuatan eksklusif (``'x'``) sudah ada.
A :exc:`TypeError` exception is raised if an object is specified but it doesn't have a :attr:`~object.__dict__` attribute (for example, if its class defines the :attr:`~object.__slots__` attribute).
Sebuah pengecualian untuk :exc:`TypeError` akan muncul jika suatu objek yang ditentukan tetapi tidak memiliki sebuah atribut :attr:`~object.__dict__` (contohnya, jika suatu kelas didefinisikan sebagai atribut :attr:`~object.__slots__`).