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
See also :func:`format` for more information.
Lihat juga :func:`format` untuk informasi lebih lanjut.
Class methods are different than C++ or Java static methods. If you want those, see :func:`staticmethod` in this section. For more information on class methods, see :ref:`types`.
Compile the *source* into a code or AST object. Code objects can be executed by :func:`exec` or :func:`eval`. *source* can either be a normal string, a byte string, or an AST object. Refer to the :mod:`ast` module documentation for information on how to work with AST objects.
Kompilasi *source* menjadi kode atau objek AST. Objek kode dapat dieksekusi oleh :func:`exec` atau :func:`eval`. *source* dapat berupa string normal, string byte, atau objek AST. Rujuk ke dokumentasi modul :mod:`ast` untuk informasi tentang cara bekerja dengan objek AST.
The *mode* argument specifies what kind of code must be compiled; it can be ``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive statement (in the latter case, expression statements that evaluate to something other than ``None`` will be printed). It can also be ``'func_type'`` if *source* consists of a function type signature, for example ``(int) -> str``; see :func:`ast.parse` for more information. This mode requires passing :data:`ast.PyCF_ONLY_AST` in *flags*.
If the object does not provide :meth:`~object.__dir__`, the function tries its best to gather information from the object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily complete and may be inaccurate when the object has a custom :func:`~object.__getattr__`.
The default :func:`dir` mechanism behaves differently with different types of objects, as it attempts to produce the most relevant, rather than complete, information:
Mekanisme bawaan :func:`dir` berperilaku berbeda dengan berbagai jenis objek, karena berusaha menghasilkan informasi yang paling relevan, dibanding lengkap,:
Return a "memory view" object created from the given argument. See :ref:`typememoryview` for more information.
Kembalikan objek "memory view" yang dibuat dari argumen yang diberikan. Lihat :ref:`typememoryview` untuk informasi lebih lanjut.
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.
The behavior of :func:`round` for floats can be surprising: for example, ``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is not a bug: it's a result of the fact that most decimal fractions can't be represented exactly as a float. See :ref:`tut-fp-issues` for more information.
Perilaku :func:`round` untuk pecahan *floats* bisa mengejutkan: misalnya, ``round(2.675, 2)`` memberikan ``2.67`` alih-alih yang diharapkan ``2.68``. Ini bukan bug: ini adalah hasil dari fakta bahwa sebagian besar pecahan desimal tidak dapat diwakili persis seperti pelampung *float*. Lihat :ref:`tut-fp-issues` untuk informasi lebih lanjut.
For more information on static methods, see :ref:`types`.
Untuk informasi lebih lanjut tentang metode statis, lihat :ref:`types`.
``str`` is the built-in string :term:`class`. For general information about strings, see :ref:`textseq`.
``str`` adalah string bawaan :term:`class`. Untuk informasi umum tentang string, lihat :ref:`textseq`.