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
|func-frozenset|_
|func-frozenset|_
|func-set|_
|func-set|_
:func:`setattr`
:func:`setattr`
Return ``True`` if all elements of the *iterable* are true (or if the iterable is empty). Equivalent to::
Kembalikan ``True`` jika semua elemen dari *iterable* bernilai benar (atau jika *iterable* kosong). Setara dengan::
Return ``True`` if any element of the *iterable* is true. If the iterable is empty, return ``False``. Equivalent to::
Kembalikan ``True`` jika ada elemen dari *iterable* bernilai benar. Jika *iterable* kosong, kembalikan ``False``. Setara dengan::
This function drops you into the debugger at the call site. Specifically, it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` expecting no arguments. In this case, it is purely a convenience function so you don't have to explicitly import :mod:`pdb` or type as much code to enter the debugger. However, :func:`sys.breakpointhook` can be set to some other function and :func:`breakpoint` will automatically call that, allowing you to drop into the debugger of choice. If :func:`sys.breakpointhook` is not accessible, this function will raise :exc:`RuntimeError`.
When compiling a string with multi-line code in ``'single'`` or ``'eval'`` mode, input must be terminated by at least one newline character. This is to facilitate detection of incomplete and complete statements in the :mod:`code` module.
Ketika mengkompilasi string dengan kode multi-baris dalam mode ``'single'`` atau ``'eval'``, masukan harus diakhiri oleh setidaknya satu karakter baris baru. Ini untuk memudahkan deteksi pernyataan tidak lengkap dan lengkap dalam modul :mod:`code`.
This is a relative of :func:`setattr`. The arguments are an object and a string. The string must be the name of one of the object's attributes. The function deletes the named attribute, provided the object allows it. For example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. *name* need not be a Python identifier (see :func:`setattr`).
For other containers see the built-in :class:`frozendict`, :class:`list`, :class:`set`, and :class:`tuple` classes, as well as the :mod:`collections` module.
Because :func:`dir` is supplied primarily as a convenience for use at an interactive prompt, it tries to supply an interesting set of names more than it tries to supply a rigorously or consistently defined set of names, and its detailed behavior may change across releases. For example, metaclass attributes are not in the result list when the argument is a class.
Karena :func:`dir` disediakan terutama sebagai kenyamanan untuk digunakan pada prompt interaktif, ia mencoba untuk memasok sekumpulan nama yang menarik lebih dari sekedar untuk menyediakan sekumpulan nama yang didefinisikan secara ketat atau konsisten, dan perilakunya yang terperinci dapat berubah lintas rilis. Misalnya, atribut metaclass tidak ada dalam daftar hasil ketika argumennya adalah kelas.
Equivalent to::
Setara dengan::
Note that ``filter(function, iterable)`` is equivalent to the generator expression ``(item for item in iterable if function(item))`` if function is not ``None`` and ``(item for item in iterable if item)`` if function is ``None``.
Perhatikan bahwa ``filter(function, iterable)`` setara dengan ekspresi generator ``(item for item in iterable if function(item))`` jika *function* tidak ``None`` dan ``(item for item in iterable if item)`` if *function* adalah ``None``.
For other containers see the built-in :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple` classes, as well as the :mod:`collections` module.
Return a new :class:`frozenset` object, optionally with elements taken from *iterable*. :class:`frozenset` is a built-in class. See also :ref:`types-set` for documentation about this class.
For other containers see the built-in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module.
Untuk wadah *containers* lain lihat kelas-kelas bawaan :class:`set`, :class:`list`,: :class:`tuple`, dan :class:`dict`, serta modul :mod:`collections`.
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`).
Return the dictionary implementing the current module namespace. For code within functions, this is set when the function is defined and remains the same regardless of where the function is called.
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
Mengembalikan panjang (jumlah item) suatu objek. Argumennya bisa berupa urutan (seperti string, byte, *tuple*, *list*, atau *range*) atau koleksi (seperti *dictionary*, set, atau *frozen set*).
*file* is a :term:`path-like object` giving the pathname (absolute or relative to the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed unless *closefd* is set to ``False``.)
*buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable when writing in text mode), and an integer > 1 to indicate the size in bytes of a fixed-size chunk buffer. Note that specifying a buffer size this way applies for binary buffered I/O, but ``TextIOWrapper`` (i.e., files opened with ``mode='r+'``) would have another buffering. To disable buffering in ``TextIOWrapper``, consider using the ``write_through`` flag for :func:`io.TextIOWrapper.reconfigure`. When no *buffering* argument is given, the default buffering policy works as follows:
When writing output to the stream, if *newline* is ``None``, any ``'\n'`` characters written are translated to the system default line separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\n'``, no translation takes place. If *newline* is any of the other legal values, any ``'\n'`` characters written are translated to the given string.
Saat menulis keluaran ke aliran *stream*, jika *newline* adalah ``None``, setiap karakter ``'\n'`` yang ditulis diterjemahkan ke pemisah garis bawaan sistem, :data:`os.linesep`. Jika *newline* adalah ``''`` atau ``'\n'``, tidak ada terjemahan yang terjadi. Jika *newline* adalah salah satu dari nilai legal lainnya, setiap karakter ``'\n'`` yang ditulis diterjemahkan ke string yang diberikan.
Return *base* to the power *exp*; if *mod* is present, return *base* to the power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the power operator: ``base**exp``.
Kembalikan *base* ke *power* *exp*; jika *mod* ada, kembalikan *base* ke *power* *exp*, *modulo* *mod* (dihitung lebih efisien daripada ``pow(base, exp) % mod``). Bentuk dua argumen ``pow(base, exp)`` setara dengan menggunakan operator *power*: ``base**exp``.
*fget* is a function for getting an attribute value. *fset* is a function for setting an attribute value. *fdel* is a function for deleting an attribute value. And *doc* creates a docstring for the attribute.
*fget* adalah fungsi untuk mendapatkan nilai atribut. *fset* adalah fungsi untuk mengatur nilai atribut. *fdel* adalah fungsi untuk menghapus nilai atribut. Dan *doc* membuat docstring untuk atribut.
class C: def __init__(self): self._x = None def getx(self): return self._x def setx(self, value): self._x = value def delx(self): del self._x x = property(getx, setx, delx, "I'm the 'x' property.")
If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = value`` will invoke the setter, and ``del c.x`` the deleter.
The ``@property`` decorator turns the :meth:`!voltage` method into a "getter" for a read-only attribute with the same name, and it sets the docstring for *voltage* to "Get the current voltage."
A property object has ``getter``, ``setter``, and ``deleter`` methods usable as decorators that create a copy of the property with the corresponding accessor function set to the decorated function. This is best explained with an example:
class C: def __init__(self): self._x = None @property def x(self): """I'm the 'x' property.""" return self._x @x.setter def x(self, value): self._x = value @x.deleter def x(self): del self._x
The returned property object also has the attributes ``fget``, ``fset``, and ``fdel`` corresponding to the constructor arguments.
Properti dari objek yang dikembalikan juga memiliki atribut ``fget``, ``fset``, dan ``fdel`` yang sesuai dengan argumen pembangun *constructor*.
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.
Return a new :class:`set` object, optionally with elements taken from *iterable*. :class:`set` is a built-in class. See also :ref:`types-set` for documentation about this class.
For other containers see the built-in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module.
Untuk wadah *containers* lain lihat kelas-kelas bawaan :class:`frozenset`, :class:`list`, :class:`tuple`, dan :class:`dict`, juga modul :mod:`collections`.
This is the counterpart of :func:`getattr`. The arguments are an object, a string, and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to ``x.foobar = 123``.
Since :ref:`private name mangling <private-name-mangling>` happens at compilation time, one must manually mangle a private attribute's (attributes with two leading underscores) name in order to set it with :func:`setattr`.
Return a :term:`slice` object representing the set of indices specified by ``range(start, stop, step)``. The *start* and *step* arguments default to ``None``.
These read-only attributes are set to the argument values (or their default). They have no other explicit functionality; however, they are used by NumPy and other third-party packages.
*key* specifies a function of one argument that is used to extract a comparison key from each element in *iterable* (for example, ``key=str.lower``). The default value is ``None`` (compare the elements directly).
*key* menentukan sebuah fungsi dari satu argumen yang digunakan untuk mengekstrak kunci perbandingan dari setiap elemen di *iterable* (misalnya, ``key=str.lower``). Nilai bawaannya adalah ``None`` (bandingkan elemen secara langsung).
*reverse* is a boolean value. If set to ``True``, then the list elements are sorted as if each comparison were reversed.
*reverse* adalah nilai *boolean*. Jika diatur ke ``True``, maka elemen list atau daftar diurutkan seolah-olah setiap perbandingan dibalik.