summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-11-10 21:20:01 (GMT)
committerGitHub <noreply@github.com>2022-11-10 21:20:01 (GMT)
commit2f4af2d99cffed6ba81e4b8fd886de6ae8625a3f (patch)
tree8f814eaf0eb5c2117e2a2ae0b26fac62f30a0d4e /Doc
parentdbf8613a2ef189592d55054c3939430f5a5977ae (diff)
downloadcpython-2f4af2d99cffed6ba81e4b8fd886de6ae8625a3f.zip
cpython-2f4af2d99cffed6ba81e4b8fd886de6ae8625a3f.tar.gz
cpython-2f4af2d99cffed6ba81e4b8fd886de6ae8625a3f.tar.bz2
GH-99183: Document behavior of count() for empty substrings (GH-99339)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 6701d79..332974e 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1617,6 +1617,9 @@ expression support in the :mod:`re` module).
range [*start*, *end*]. Optional arguments *start* and *end* are
interpreted as in slice notation.
+ If *sub* is empty, returns the number of empty strings between characters
+ which is the length of the string plus one.
+
.. method:: str.encode(encoding="utf-8", errors="strict")
@@ -2698,6 +2701,9 @@ arbitrary binary data.
The subsequence to search for may be any :term:`bytes-like object` or an
integer in the range 0 to 255.
+ If *sub* is empty, returns the number of empty slices between characters
+ which is the length of the bytes object plus one.
+
.. versionchanged:: 3.3
Also accept an integer in the range 0 to 255 as the subsequence.