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
Return an :term:`asynchronous iterator` for an :term:`asynchronous iterable`. Equivalent to calling ``x.__aiter__()``.
Return :const:`True` if the *object* argument appears callable, :const:`False` if not. If this returns ``True``, it is still possible that a call fails, but if it is ``False``, calling *object* will never succeed. Note that classes are callable (calling a class returns a new instance); instances are callable if their class has a :meth:`~object.__call__` method.
The optional arguments *flags* and *dont_inherit* control which :ref:`compiler options <ast-compiler-flags>` should be activated and which :ref:`future features <future>` should be allowed. If neither is present (or both are zero) the code is compiled with the same flags that affect the code that is calling :func:`compile`. If the *flags* argument is given and *dont_inherit* is not (or is zero) then the compiler options and the future statements specified by the *flags* argument are used in addition to those that would be used anyway. If *dont_inherit* is a non-zero integer then the *flags* argument is it -- the flags (future features and compiler options) in the surrounding code are ignored.
This function executes arbitrary code. Calling it with untrusted user-supplied input will lead to security vulnerabilities.
The *source* argument is parsed and evaluated as a Python expression (technically speaking, an :ref:`expression list <exprlists>`) using the *globals* and *locals* mappings as global and local namespace. If the *globals* dictionary is present and does not contain a value for the key ``__builtins__``, a reference to the dictionary of the built-in module :mod:`builtins` is inserted under that key before *source* is parsed. Overriding ``__builtins__`` can be used to restrict or change the available names, but this is **not** a security mechanism: the executed code can still access all builtins. If the *locals* mapping is omitted it defaults to the *globals* dictionary. If both mappings are omitted, the source is executed with the *globals* and *locals* in the environment where :func:`eval` is called. Note, *eval()* will only have access to the :term:`nested scopes <nested scope>` (non-locals) in the enclosing environment if they are already referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement).
The default *format_spec* is an empty string which usually gives the same effect as calling :func:`str(value) <str>`.
Default *format_spec* adalah string kosong yang biasanya memberikan efek yang sama dengan memanggil :func:`str(value) <str>`.
The arguments are an object and a string. The result is ``True`` if the string is the name of one of the object's attributes, ``False`` if not. (This is implemented by calling ``getattr(object, name)`` and seeing whether it raises an :exc:`AttributeError` or not.)
Argumen adalah objek dan string. Hasilnya adalah ``True`` jika string adalah nama salah satu atribut objek, ``False`` jika tidak. (Ini diimplementasikan dengan memanggil ``getattr(object, name)`` dan melihat apakah itu memunculkan :exc:`AttributeError` atau tidak.)
Calling ``locals()`` as part of a comprehension in a function, generator, or coroutine is equivalent to calling it in the containing scope, except that the comprehension's initialised iteration variables will be included. In other scopes, it behaves as if the comprehension were running as a nested function.
Calling ``locals()`` as part of a generator expression is equivalent to calling it in a nested generator function.
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.
A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing :mod:`os.open` as *opener* results in functionality similar to passing ``None``).
Pembuka khusus dapat digunakan dengan melewatkan *callable* sebagai *opener*. Deskriptor berkas yang mendasari untuk objek berkas kemudian diperoleh dengan memanggil *opener* dengan (*file*, *flags*). *opener* harus mengembalikan deskriptor berkas terbuka (lewat :mod:`os.open` sebagai *opener* menghasilkan fungsionalitas yang mirip dengan melewatkan ``None``).
For some use cases, there are good alternatives to :func:`sum`. The preferred, fast way to concatenate a sequence of strings is by calling ``''.join(sequence)``. To add floating-point values with extended precision, see :func:`math.fsum`\. To concatenate a series of iterables, consider using :func:`itertools.chain`.
The second use case is to support cooperative multiple inheritance in a dynamic execution environment. This use case is unique to Python and is not found in statically compiled languages or languages that only support single inheritance. This makes it possible to implement "diamond diagrams" where multiple base classes implement the same method. Good design dictates that such implementations have the same calling signature in every case (because the order of calls is determined at runtime, because that order adapts to changes in the class hierarchy, and because that order can include sibling classes that are unknown prior to runtime).
In addition to method lookups, :func:`super` also works for attribute lookups. One possible use case for this is calling :term:`descriptors <descriptor>` in a parent or sibling class.
Selain pencarian metode, :func:`super` juga berfungsi untuk pencarian atribut. Salah satu kemungkinan kasus penggunaan ini adalah pemanggilan :term:`descriptors <descriptor>` di kelas induk atau saudara kandung.
The result of calling this function without an argument has been updated as described for the :func:`locals` builtin.