]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-99183: Document behavior of count() for empty substrings (GH-99339)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Thu, 10 Nov 2022 21:20:01 +0000 (15:20 -0600)
committerGitHub <noreply@github.com>
Thu, 10 Nov 2022 21:20:01 +0000 (15:20 -0600)
Doc/library/stdtypes.rst

index 6701d794b5111bc16456c47c579016314849b29c..332974e738c39355f8f506b1a49cdf60b051da3b 100644 (file)
@@ -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.