8000 GH-99183: Document behavior of count() for empty substrings (GH-99339) · python/cpython@f7d3b18 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7d3b18

Browse files
GH-99183: Document behavior of count() for empty substrings (GH-99339)
(cherry picked from commit 2f4af2d) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent 9a5ca31 commit f7d3b18

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,9 @@ expression support in the :mod:`re` module).
15791579
range [*start*, *end*]. Optional arguments *start* and *end* are
15801580
interpreted as in slice notation.
15811581

1582+
If *sub* is empty, returns the number of empty strings between characters
1583+
which is the length of the string plus one.
1584+
15821585

15831586
.. method:: str.encode(encoding="utf-8", errors="strict")
15841587

@@ -2658,6 +2661,9 @@ arbitrary binary data.
26582661
The subsequence to search for may be any :term:`bytes-like object` or an
26592662
integer in the range 0 to 255.
26602663

2664+
If *sub* is empty, returns the number of empty slices between characters
2665+
which is the length of the bytes object plus one.
2666+
26612667
.. versionchanged:: 3.3
26622668
Also accept an integer in the range 0 to 255 as the subsequence.
26632669

0 commit comments

Comments
 (0)
0