Visitar URL original
gh-102500: Remove mention of bytes shorthand by hauntsaninja 路 Pull Request #104281 路 python/cpython 路 GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-102500: Remove mention of bytes shorthand
The bytes shorthand was removed in PEP 688:
https://peps.python.org/pep-0688/#no-special-meaning-for-bytes

I also remove the reference to `collections.abc.ByteString`, since that
object is deprecated (#91896) and has different semantics (#102092)

I think it would be good to backport this since the changes in the type
system are immediate and apply to all versions of Python.
  • Loading branch information
hauntsaninja committed May 8, 2023
commit e807bce3202fca54bdc65ffb4b5faccab4c4a0ae
5 changes: 0 additions & 5 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2130,14 +2130,9 @@ Corresponding to collections in :mod:`collections.abc`

.. class:: ByteString(Sequence[int])

A generic version of :class:`collections.abc.ByteString`.

This type represents the types :class:`bytes`, :class:`bytearray`,
and :class:`memoryview` of byte sequences.

As a shorthand for this type, :class:`bytes` can be used to
annotate arguments of any of the types mentioned above.

.. deprecated:: 3.9
Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray | memoryview``.

Expand Down