@@ -1225,8 +1225,8 @@ the underlying generator function:
12251225 If the asynchronous generator function then exits gracefully, is already
12261226 closed, or raises :exc: `GeneratorExit ` (by not catching the exception),
12271227 then the returned awaitable will raise a :exc: `StopIteration ` exception.
1228- Any further awaitables returned by subsequent calls to the asynchronous
1229- generator will raise a :exc: `StopAsyncIteration ` exception.
1228+ Awaitables returned by subsequent calls to :meth: ` ~agen.__anext__ `
1229+ or :meth: ` ~agen.asend ` will raise a :exc: `StopAsyncIteration ` exception.
12301230
12311231 If the asynchronous generator yields a value, a :exc: `RuntimeError ` is
12321232 raised by the awaitable.
@@ -2129,13 +2129,23 @@ expression support in the :mod:`re` module).
21292129.. method :: str.capitalize()
21302130
21312131 Return a copy of the string with its first character capitalized and the
2132- rest lowercased.
2132+ rest lowercased. For example:
2133+
2134+ .. doctest ::
2135+
2136+ >>> ' PYTHON IS AMAZING' .capitalize()
2137+ 'Python is amazing'
2138+ >>> ' Njemačka starts With a non-ASCII digraph' .capitalize()
2139+ 'Njemačka starts with a non-ascii digraph'
2140+
2141+ See also :meth: `title `.
21332142
21342143 .. versionchanged :: 3.8
21352144 The first character is now put into titlecase rather than uppercase.
21362145 This means that characters like digraphs will only have their first
21372146 letter capitalized, instead of the full character.
21382147
2148+
21392149.. method :: str.casefold()
21402150
21412151 Return a casefolded copy of the string. Casefolded strings may be used for
@@ -2303,19 +2313,19 @@ expression support in the :mod:`re` module).
23032313
23042314 Perform a string formatting operation. The string on which this method is
23052315 called can contain literal text or replacement fields delimited by braces
2306- ``{} ``. Each replacement field contains either the numeric index of a
2307- positional argument, or the name of a keyword argument. Returns a copy of
2316+ ``{} ``. Each replacement field refers to a positional argument (numbered
2317+ explicitly or automatically) or a keyword argument. Returns a copy of
23082318 the string where each replacement field is replaced with the string value of
23092319 the corresponding argument. For example:
23102320
23112321 .. doctest ::
23122322
2313- >>> " The sum of 1 + 2 is {0} " .format(1 + 2 )
2314- 'The sum of 1 + 2 is 3'
2315- >>> " The sum of {a} + {b} is {answer} " .format(answer = 1 + 2 , a = 1 , b = 2 )
2323+ >>> " The sum of {} + {} is {} " .format(1 , 2 , 1 + 2 )
23162324 'The sum of 1 + 2 is 3'
23172325 >>> " {1} expects the {0} Inquisition!" .format(" Spanish" , " Nobody" )
23182326 'Nobody expects the Spanish Inquisition!'
2327+ >>> " The sum of {a} + {b} is {answer} " .format(answer = 1 + 2 , a = 1 , b = 2 )
2328+ 'The sum of 1 + 2 is 3'
23192329
23202330 See :ref: `formatstrings ` for a description of the various formatting options
23212331 that can be specified in format strings.
@@ -3137,7 +3147,7 @@ expression support in the :mod:`re` module).
31373147 >>> titlecase("they're bill's friends.")
31383148 "They're Bill's Friends."
31393149
3140- See also :meth: `istitle `.
3150+ See also :meth: `istitle ` and :meth: ` capitalize ` .
31413151
31423152
31433153.. method :: str.translate(table, /)
@@ -3170,7 +3180,7 @@ expression support in the :mod:`re` module).
31703180
31713181 Return a copy of the string with all the cased characters [4 ]_ converted to
31723182 uppercase. Note that ``s.upper().isupper() `` might be ``False `` if ``s ``
3173- contains uncased characters or if the Unicode category of the resulting
3183+ contains no cased characters or if the Unicode category of the resulting
31743184 character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
31753185 titlecase).
31763186
@@ -3527,9 +3537,8 @@ The conversion types are:
35273537| | character in the result. | |
35283538+------------+-----------------------------------------------------+-------+
35293539
3530- For floating-point formats, the result should be correctly rounded to a given
3531- precision ``p `` of digits after the decimal point. The rounding mode matches
3532- that of the :func: `round ` builtin.
3540+ For floating-point formats, the result should be correctly rounded to the
3541+ specified precision. The rounding mode matches that of the :func: `round ` builtin.
35333542
35343543Notes:
35353544
@@ -5918,8 +5927,9 @@ can be used interchangeably to index the same dictionary entry.
59185927
59195928
59205929 .. seealso ::
5921- :class: `frozendict ` and :class: `types.MappingProxyType ` can be used to
5922- create a read-only view of a :class: `dict `.
5930+ :class: `types.MappingProxyType ` can be used to create a read-only view
5931+ of a :class: `dict `. :class: `frozendict ` is an immutable version of
5932+ :class: `dict `.
59235933
59245934.. seealso ::
59255935
@@ -6072,8 +6082,7 @@ Frozen dictionaries
60726082
60736083 Similar to :meth: `dict.fromkeys `, but call again the type constructor
60746084 with an initialized :class: `frozendict ` if the type is a
6075- :class: `frozendict ` subclass or if the constructor returned a
6076- :class: `frozendict `.
6085+ :class: `frozendict ` subclass.
60776086
60786087 .. versionadded :: 3.15
60796088
@@ -6522,8 +6531,8 @@ The user-exposed type for the union object can be accessed from
65226531
65236532.. note ::
65246533 The :meth: `!__or__ ` method for type objects was added to support the syntax
6525- ``X | Y ``. If a metaclass implements :meth: `!__or__ `, the Union may
6526- override it :
6534+ ``X | Y ``. If a metaclass implements :meth: `!__or__ `, it may override
6535+ the default behavior of creating a union :
65276536
65286537 .. doctest ::
65296538
0 commit comments