Skip to content

Commit 899cc86

Browse files
Fix error with stop/end, update chr() and ord(), change kwdto kwargs.
1 parent 94cc645 commit 899cc86

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

Doc/library/functions.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,14 @@ are always available. They are listed here in alphabetical order.
242242
in Python 3.2.
243243

244244

245-
.. function:: chr(i, /)
245+
.. function:: chr(codepoint, /)
246246

247-
Return the string representing a character whose Unicode code point is the
248-
integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while
247+
Return the string representing a character with the specified Unicode code point.
248+
For example, ``chr(97)`` returns the string ``'a'``, while
249249
``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`.
250250

251251
The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in
252-
base 16). :exc:`ValueError` will be raised if *i* is outside that range.
252+
base 16). :exc:`ValueError` will be raised if it is outside that range.
253253

254254

255255
.. decorator:: classmethod
@@ -1559,13 +1559,18 @@ are always available. They are listed here in alphabetical order.
15591559
.. versionchanged:: 3.11
15601560
The ``'U'`` mode has been removed.
15611561

1562-
.. function:: ord(c, /)
1562+
.. function:: ord(character, /)
15631563

1564-
Given a string representing one Unicode character, return an integer
1564+
The argument must be a one-character string or a :term:`bytes-like object`
1565+
of length 1.
1566+
If it is a one-character string, return an integer
15651567
representing the Unicode code point of that character. For example,
15661568
``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign)
15671569
returns ``8364``. This is the inverse of :func:`chr`.
15681570

1571+
If the argument is a bytes-like object of length 1, return an integer value
1572+
of its element.
1573+
15691574

15701575
.. function:: pow(base, exp, mod=None)
15711576

@@ -2059,7 +2064,7 @@ are always available. They are listed here in alphabetical order.
20592064

20602065

20612066
.. class:: type(object, /)
2062-
type(name, bases, dict, /, **kwds)
2067+
type(name, bases, dict, /, **kwargs)
20632068
20642069
.. index:: pair: object; type
20652070

Doc/library/stdtypes.rst

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ expression support in the :mod:`re` module).
18061806
'Python'
18071807

18081808

1809-
.. method:: str.count(sub, start=0, stop=None, /)
1809+
.. method:: str.count(sub, start=0, end=None, /)
18101810

18111811
Return the number of non-overlapping occurrences of substring *sub* in the
18121812
range [*start*, *end*]. Optional arguments *start* and *end* are
@@ -1861,7 +1861,7 @@ expression support in the :mod:`re` module).
18611861
in :ref:`debug mode <debug-build>`.
18621862

18631863

1864-
.. method:: str.endswith(suffix, start=0, stop=None, /)
1864+
.. method:: str.endswith(suffix, start=0, end=None, /)
18651865

18661866
Return ``True`` if the string ends with the specified *suffix*, otherwise return
18671867
``False``. *suffix* can also be a tuple of suffixes to look for. With optional
@@ -1905,7 +1905,7 @@ expression support in the :mod:`re` module).
19051905
0123 01234
19061906

19071907

1908-
.. method:: str.find(sub, start=0, stop=None, /)
1908+
.. method:: str.find(sub, start=0, end=None, /)
19091909

19101910
Return the lowest index in the string where substring *sub* is found within
19111911
the slice ``s[start:end]``. Optional arguments *start* and *end* are
@@ -1968,7 +1968,7 @@ expression support in the :mod:`re` module).
19681968
.. versionadded:: 3.2
19691969

19701970

1971-
.. method:: str.index(sub, start=0, stop=None, /)
1971+
.. method:: str.index(sub, start=0, end=None, /)
19721972

19731973
Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is
19741974
not found.
@@ -2217,14 +2217,14 @@ expression support in the :mod:`re` module).
22172217
*count* is now supported as a keyword argument.
22182218

22192219

2220-
.. method:: str.rfind(sub, start=0, stop=None, /)
2220+
.. method:: str.rfind(sub, start=0, end=None, /)
22212221

22222222
Return the highest index in the string where substring *sub* is found, such
22232223
that *sub* is contained within ``s[start:end]``. Optional arguments *start*
22242224
and *end* are interpreted as in slice notation. Return ``-1`` on failure.
22252225

22262226

2227-
.. method:: str.rindex(sub, start=0, stop=None, /)
2227+
.. method:: str.rindex(sub, start=0, end=None, /)
22282228

22292229
Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is not
22302230
found.
@@ -2395,7 +2395,7 @@ expression support in the :mod:`re` module).
23952395
['Two lines', '']
23962396

23972397

2398-
.. method:: str.startswith(prefix, start=0, stop=None, /)
2398+
.. method:: str.startswith(prefix, start=0, end=None, /)
23992399

24002400
Return ``True`` if string starts with the *prefix*, otherwise return ``False``.
24012401
*prefix* can also be a tuple of prefixes to look for. With optional *start*,
@@ -3141,8 +3141,8 @@ binary data. These restrictions are covered below.
31413141
The following methods on bytes and bytearray objects can be used with
31423142
arbitrary binary data.
31433143

3144-
.. method:: bytes.count(sub, start=0, stop=None, /)
3145-
bytearray.count(sub, start=0, stop=None, /)
3144+
.. method:: bytes.count(sub, start=0, end=None, /)
3145+
bytearray.count(sub, start=0, end=None, /)
31463146

31473147
Return the number of non-overlapping occurrences of subsequence *sub* in
31483148
the range [*start*, *end*]. Optional arguments *start* and *end* are
@@ -3234,8 +3234,8 @@ arbitrary binary data.
32343234
in :ref:`debug mode <debug-build>`.
32353235

32363236

3237-
.. method:: bytes.endswith(suffix, start=0, stop=None, /)
3238-
bytearray.endswith(suffix, start=0, stop=None, /)
3237+
.. method:: bytes.endswith(suffix, start=0, end=None, /)
3238+
bytearray.endswith(suffix, start=0, end=None, /)
32393239

32403240
Return ``True`` if the binary data ends with the specified *suffix*,
32413241
otherwise return ``False``. *suffix* can also be a tuple of suffixes to
@@ -3245,8 +3245,8 @@ arbitrary binary data.
32453245
The suffix(es) to search for may be any :term:`bytes-like object`.
32463246

32473247

3248-
.. method:: bytes.find(sub, start=0, stop=None, /)
3249-
bytearray.find(sub, start=0, stop=None, /)
3248+
.. method:: bytes.find(sub, start=0, end=None, /)
3249+
bytearray.find(sub, start=0, end=None, /)
32503250

32513251
Return the lowest index in the data where the subsequence *sub* is found,
32523252
such that *sub* is contained in the slice ``s[start:end]``. Optional
@@ -3269,8 +3269,8 @@ arbitrary binary data.
32693269
Also accept an integer in the range 0 to 255 as the subsequence.
32703270

32713271

3272-
.. method:: bytes.index(sub, start=0, stop=None, /)
3273-
bytearray.index(sub, start=0, stop=None, /)
3272+
.. method:: bytes.index(sub, start=0, end=None, /)
3273+
bytearray.index(sub, start=0, end=None, /)
32743274

32753275
Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the
32763276
subsequence is not found.
@@ -3333,8 +3333,8 @@ arbitrary binary data.
33333333
always produces a new object, even if no changes were made.
33343334

33353335

3336-
.. method:: bytes.rfind(sub, start=0, stop=None, /)
3337-
bytearray.rfind(sub, start=0, stop=None, /)
3336+
.. method:: bytes.rfind(sub, start=0, end=None, /)
3337+
bytearray.rfind(sub, start=0, end=None, /)
33383338

33393339
Return the highest index in the sequence where the subsequence *sub* is
33403340
found, such that *sub* is contained within ``s[start:end]``. Optional
@@ -3348,8 +3348,8 @@ arbitrary binary data.
33483348
Also accept an integer in the range 0 to 255 as the subsequence.
33493349

33503350

3351-
.. method:: bytes.rindex(sub, start=0, stop=None, /)
3352-
bytearray.rindex(sub, start=0, stop=None, /)
3351+
.. method:: bytes.rindex(sub, start=0, end=None, /)
3352+
bytearray.rindex(sub, start=0, end=None, /)
33533353

33543354
Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the
33553355
subsequence *sub* is not found.
@@ -3374,8 +3374,8 @@ arbitrary binary data.
33743374
The separator to search for may be any :term:`bytes-like object`.
33753375

33763376

3377-
.. method:: bytes.startswith(prefix, start=0, stop=None, /)
3378-
bytearray.startswith(prefix, start=0, stop=None, /)
3377+
.. method:: bytes.startswith(prefix, start=0, end=None, /)
3378+
bytearray.startswith(prefix, start=0, end=None, /)
33793379

33803380
Return ``True`` if the binary data starts with the specified *prefix*,
33813381
otherwise return ``False``. *prefix* can also be a tuple of prefixes to
@@ -4501,10 +4501,10 @@ copying.
45014501

45024502
.. versionadded:: 3.14
45034503

4504-
.. method:: index(value, start=0, stop=None, /)
4504+
.. method:: index(value, start=0, end=None, /)
45054505

45064506
Return the index of the first occurrence of *value* (at or after
4507-
index *start* and before index *stop*).
4507+
index *start* and before index *end*).
45084508

45094509
Raises a :exc:`ValueError` if *value* cannot be found.
45104510

0 commit comments

Comments
 (0)