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 function was first removed in Python 3.0 and then brought back in Python 3.2.
Fungsi ini pertama kali dihapus di Python 3.0 dan kemudian dibawa kembali di Python 3.2.
A class method receives the class as an implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom::
A class method can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Metode kelas dapat dipanggil baik pada kelas (seperti ``C.f()``) atau pada *instance* (seperti ``C().f()``). Instance diabaikan kecuali untuk kelasnya. Jika metode kelas dipanggil untuk kelas turunan, objek kelas turunan dilewatkan sebagai argumen pertama yang tersirat.
The first parameter is now positional-only.
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.
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)``.
open for writing, truncating the file first
buka untuk menulis, mengosongkan berkas terlebih dahulu
As mentioned in the :ref:`io-overview`, Python distinguishes between binary and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* argument) return contents as :class:`bytes` objects without any decoding. In text mode (the default, or when ``'t'`` is included in the *mode* argument), the contents of the file are returned as :class:`str`, the bytes having been first decoded using the default encoding or using the specified *encoding* if given.
This code is exactly equivalent to the first example. Be sure to give the additional functions the same name as the original property (``x`` in this case.)
Kode ini persis sama dengan contoh pertama. Pastikan untuk memberi fungsi tambahan nama yang sama dengan properti asli (``x`` dalam kasus ini.)
A static method does not receive an implicit first argument. To declare a static method, use this idiom::
Metode statis tidak menerima argumen implisit pertama. Untuk mendeklarasikan metode statis, gunakan idiom ini::
When called directly within an ordinary method of a class, both arguments may be omitted ("zero-argument :func:`!super`"). In this case, *type* will be the enclosing class, and *object_or_type* will be the first argument of the immediately enclosing function (typically ``self``). Zero-argument :func:`!super` will not work as expected within nested functions, including generator expressions, which implicitly create nested functions.
When the *name* variable is of the form ``package.module``, normally, the top-level package (the name up till the first dot) is returned, *not* the module named by *name*. However, when a non-empty *fromlist* argument is given, the module named by *name* is returned.
Ketika variabel *name* dalam bentuk ``package.module``, biasanya, paket tingkat atas (nama hingga titik pertama) dikembalikan, *not* modul dinamai dengan *name*. Namun, ketika argumen tidak-kosong *fromlist * diberikan, modul bernama oleh *name* dikembalikan.