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
If it is an object conforming to the :ref:`buffer interface <bufferobjects>`, a read-only buffer of the object will be used to initialize the bytes array.
Jika itu adalah objek yang sesuai dengan :ref:`buffer interface <bufferobjects>`, buffer yang hanya baca dari objek tersebut akan digunakan untuk menginisialisasi array byte.
Bytes objects can also be created with literals, see :ref:`strings`.
Objek byte juga dapat dibuat dengan literal, lihat :ref:`strings`.
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.
If the object has a method named :meth:`~object.__dir__`, this method will be called and must return the list of attributes. This allows objects that implement a custom :func:`~object.__getattr__` or :func:`~object.__getattribute__` function to customize the way :func:`dir` reports their attributes.
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,:
This function can also be used to execute arbitrary code objects (such as those created by :func:`compile`). In this case, pass a code object instead of a string. If the code object has been compiled with ``'exec'`` as the *mode* argument, :func:`eval`\'s return value will be ``None``.
When ``exec`` gets two separate objects as *globals* and *locals*, the code will be executed as if it were embedded in a class definition. This means functions and classes defined in the executed code will not be able to access variables assigned at the top level (as the "top level" variables are treated as class variables in a class definition).
For objects with custom :meth:`~object.__hash__` methods, note that :func:`hash` truncates the return value based on the bit width of the host machine.
Return the "identity" of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same :func:`id` value.
Kembalikan "identity" suatu objek. Ini adalah bilangan bulat yang dijamin unik dan konstan untuk objek ini selama masa pakainya. Dua objek dengan masa hidup yang tidak tumpang tindih mungkin memiliki nilai yang sama :func:`id`.
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.
As part of :pep:`667`, the semantics of mutating the mapping objects returned from this function are now defined. The behavior in :term:`optimized scopes <optimized scope>` is now as described above. Aside from being defined, the behaviour in other scopes remains unchanged from previous versions.
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.
Support added to accept objects implementing :class:`os.PathLike`.
Dukungan ditambahkan untuk menerima objek yang mengimplementasikan :class:`os.PathLike`.
Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword arguments.
All non-keyword arguments are converted to strings like :func:`str` does and written to the stream, separated by *sep* and followed by *end*. Both *sep* and *end* must be strings; they can also be ``None``, which means to use the default values. If no *objects* are given, :func:`print` will just write *end*.
Semua argumen non-kata kunci dikonversi ke string seperti :func:`str` dan ditulis ke aliran *stream*, dipisahkan oleh *sep* dan diikuti oleh *end*. Baik *sep* dan *end* harus berupa string; mereka juga bisa ``None``, yang berarti menggunakan nilai bawaan. Jika tidak ada *objects* yang diberikan, :func:`print` hanya akan menulis *end*.
The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` will be used. Since printed arguments are converted to text strings, :func:`print` cannot be used with binary mode file objects. For these, use ``file.write(...)`` instead.
Argumen *file* harus berupa objek dengan metode ``write(string)``; jika tidak ada atau ``None``, :data:`sys.stdout` akan digunakan. Karena argumen yang dicetak dikonversi ke string teks, :func:`print` tidak dapat digunakan dengan objek file mode biner. Untuk ini, gunakan ``file.write(...)`` sebagai gantinya.
The docstrings of property objects are now writeable.
docstrings dari properti objek-objek sekarang dapat ditulisi.
Sentinel objects are true and compare equal only to themselves. They are intended to be compared with the :keyword:`is` operator.
Sentinel objects support the :ref:`| <bitwise>` operator for use in type expressions.
:mod:`Pickling <pickle>` is supported for sentinel objects that are placed in the global scope of a module under a name matching the sentinel's name, and for sentinels placed in class scopes with a name matching the :term:`qualified name` of the sentinel. Other sentinels, such as those defined in a function scope, are not picklable. The identity of the sentinel is preserved after pickling::
Sentinel objects have the following attributes:
Slice objects are also generated when :ref:`slicing syntax <slicings>` is used. For example: ``a[start:stop:step]`` or ``a[start:stop, i]``.
Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` are hashable).
:class:`super` objects are now :mod:`pickleable <pickle>` and :mod:`copyable <copy>`.
With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The *name* string is the class name and becomes the :attr:`~type.__name__` attribute. The *bases* tuple contains the base classes and becomes the :attr:`~type.__bases__` attribute; if empty, :class:`object`, the ultimate base of all classes, is added. The *dict* dictionary contains attribute and method definitions for the class body; it may be copied or wrapped before becoming the :attr:`~type.__dict__` attribute. The following two statements create identical :class:`!type` objects:
:ref:`bltin-type-objects`
Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their :attr:`!__dict__` attributes (for example, classes use a :class:`types.MappingProxyType` to prevent direct dictionary updates).
The function imports the module *name*, potentially using the given *globals* and *locals* to determine how to interpret the name in a package context. The *fromlist* gives the names of objects or submodules that should be imported from the module given by *name*. The standard implementation does not use its *locals* argument at all and uses its *globals* only to determine the package context of the :keyword:`import` statement.