Pelokalan
Python ID
id en
Masuk
Proyek
whatsnew__3-5.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
:pep:`465` adds the ``@`` infix operator for matrix multiplication. Currently, no builtin Python types implement the new operator, however, it can be implemented by defining :meth:`~object.__matmul__`, :meth:`~object.__rmatmul__`, and :meth:`~object.__imatmul__` for regular, reflected, and in-place matrix multiplication. The semantics of these methods is similar to that of methods defining other infix arithmetic operators.
Note that ``%s`` and ``%r`` conversion types, although supported, should only be used in codebases that need compatibility with Python 2.
The type system supports unions, generic types, and a special type named :class:`~typing.Any` which is consistent with (i.e. assignable to and from) all types.
The new :func:`util.module_from_spec() <importlib.util.module_from_spec>` function is now the preferred way to create a new module. As opposed to creating a :class:`types.ModuleType` instance directly, this new function will set the various import-controlled attributes based on the passed-in spec object. (Contributed by Brett Cannon in :issue:`20383`.)
:func:`sharedctypes.synchronized() <multiprocessing.sharedctypes.synchronized>` objects now support the :term:`context manager` protocol. (Contributed by Charles-François Natali in :issue:`21565`.)
types
types
A new :func:`~types.coroutine` function to transform :term:`generator <generator iterator>` and :class:`generator-like <collections.abc.Generator>` objects into :term:`awaitables <awaitable>`. (Contributed by Yury Selivanov in :issue:`24017`.)
A new type called :class:`~types.CoroutineType`, which is used for :term:`coroutine` objects created by :keyword:`async def` functions. (Contributed by Yury Selivanov in :issue:`24400`.)
Because the lack of the :attr:`~type.__module__` attribute breaks pickling and introspection, a deprecation warning is now raised for builtin types without the :attr:`~type.__module__` attribute. This will be an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:`20204`.)
As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures and functions.