mirror of
https://github.com/python/cpython.git
synced 2025-10-02 05:12:23 +00:00
gh-102500: Remove mention of bytes shorthand (#104281) The bytes shorthand was removed in PEP 688: https://peps.python.org/pep-0688/#no-special-meaning-for-bytes The reference to collections.abc.ByteString is also removed, since that object is deprecated (#91896) and has different semantics (#102092) Although PEP 688 is new in Python 3.12, type checkers are expected to implement the new semantics for type annotations even if users are using an older version of Python, so this docs PR is backported to Python 3.11. Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
065e2ae99a
commit
499b79d0b9
1 changed files with 4 additions and 8 deletions
|
@ -2090,17 +2090,11 @@ Corresponding to collections in :mod:`collections.abc`
|
||||||
|
|
||||||
.. class:: ByteString(Sequence[int])
|
.. class:: ByteString(Sequence[int])
|
||||||
|
|
||||||
A generic version of :class:`collections.abc.ByteString`.
|
|
||||||
|
|
||||||
This type represents the types :class:`bytes`, :class:`bytearray`,
|
This type represents the types :class:`bytes`, :class:`bytearray`,
|
||||||
and :class:`memoryview` of byte sequences.
|
and :class:`memoryview` of byte sequences.
|
||||||
|
|
||||||
As a shorthand for this type, :class:`bytes` can be used to
|
.. deprecated-removed:: 3.9 3.14
|
||||||
annotate arguments of any of the types mentioned above.
|
Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray | memoryview``.
|
||||||
|
|
||||||
.. deprecated:: 3.9
|
|
||||||
:class:`collections.abc.ByteString` now supports subscripting (``[]``).
|
|
||||||
See :pep:`585` and :ref:`types-genericalias`.
|
|
||||||
|
|
||||||
.. class:: Collection(Sized, Iterable[T_co], Container[T_co])
|
.. class:: Collection(Sized, Iterable[T_co], Container[T_co])
|
||||||
|
|
||||||
|
@ -2892,5 +2886,7 @@ convenience. This is subject to change, and not all deprecations are listed.
|
||||||
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
|
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
|
||||||
| collections | | | |
|
| collections | | | |
|
||||||
+----------------------------------+---------------+-------------------+----------------+
|
+----------------------------------+---------------+-------------------+----------------+
|
||||||
|
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
|
||||||
|
+----------------------------------+---------------+-------------------+----------------+
|
||||||
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
|
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
|
||||||
+----------------------------------+---------------+-------------------+----------------+
|
+----------------------------------+---------------+-------------------+----------------+
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue