Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Revert "Rename "bytes" back to "chars"."
This reverts commit b159ccd.
  • Loading branch information
serhiy-storchaka committed Aug 13, 2025
commit c2068d2d27bef3a6495f8a1ebf32616cbe7c8480
30 changes: 15 additions & 15 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3440,14 +3440,14 @@ produce new objects.
it always produces a new object, even if no changes were made.


.. method:: bytes.lstrip(chars=None, /)
bytearray.lstrip(chars=None, /)
.. method:: bytes.lstrip(bytes=None, /)
bytearray.lstrip(bytes=None, /)

Return a copy of the sequence with specified leading bytes removed. The
*chars* argument is a binary sequence specifying the set of byte values to
*bytes* argument is a binary sequence specifying the set of byte values to
be removed - the name refers to the fact this method is usually used with
ASCII characters. If omitted or ``None``, the *chars* argument defaults
to removing ASCII whitespace. The *chars* argument is not a prefix;
ASCII characters. If omitted or ``None``, the *bytes* argument defaults
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence no longer makes sense after changing the argument name

to removing ASCII whitespace. The *bytes* argument is not a prefix;
rather, all combinations of its values are stripped::

>>> b' spacious '.lstrip()
Expand Down Expand Up @@ -3496,14 +3496,14 @@ produce new objects.
:meth:`split` which is described in detail below.


.. method:: bytes.rstrip(chars=None, /)
bytearray.rstrip(chars=None, /)
.. method:: bytes.rstrip(bytes=None, /)
bytearray.rstrip(bytes=None, /)

Return a copy of the sequence with specified trailing bytes removed. The
*chars* argument is a binary sequence specifying the set of byte values to
*bytes* argument is a binary sequence specifying the set of byte values to
be removed - the name refers to the fact this method is usually used with
ASCII characters. If omitted or ``None``, the *chars* argument defaults to
removing ASCII whitespace. The *chars* argument is not a suffix; rather,
ASCII characters. If omitted or ``None``, the *bytes* argument defaults to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence no longer makes sense after changing the argument name

removing ASCII whitespace. The *bytes* argument is not a suffix; rather,
all combinations of its values are stripped::

>>> b' spacious '.rstrip()
Expand Down Expand Up @@ -3573,14 +3573,14 @@ produce new objects.
[b'1', b'2', b'3']


.. method:: bytes.strip(chars=None, /)
bytearray.strip(chars=None, /)
.. method:: bytes.strip(bytes=None, /)
bytearray.strip(bytes=None, /)

Return a copy of the sequence with specified leading and trailing bytes
removed. The *chars* argument is a binary sequence specifying the set of
removed. The *bytes* argument is a binary sequence specifying the set of
byte values to be removed - the name refers to the fact this method is
usually used with ASCII characters. If omitted or ``None``, the *chars*
argument defaults to removing ASCII whitespace. The *chars* argument is
usually used with ASCII characters. If omitted or ``None``, the *bytes*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence no longer makes sense after changing the argument name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, happy to explain. It currently says:

The chars argument is a binary sequence specifying the set of byte values to be removed - the name refers to the fact this method is usually used with ASCII characters.

This PR changes *chars* to *bytes*, which means the second half of the sentence doesn't make sense / no longer applies. It should be removed or changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Then I'll restore chars. This is not the best name, but this should be a separate issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On other hand, bytes is already used in the signature for long time. So this is in the scope of this PR.

argument defaults to removing ASCII whitespace. The *bytes* argument is
not a prefix or suffix; rather, all combinations of its values are
stripped::

Expand Down