[3.7] bpo-34682: Wording and grammatical changes to the doc(https://d… · python/cpython@074d7c4 (original) (raw)

`@@ -144,7 +144,7 @@ the single expression that makes up the expression list.

`

144

144

`.. index:: pair: empty; tuple

`

145

145

``

146

146

`An empty pair of parentheses yields an empty tuple object. Since tuples are

`

147

``

`-

immutable, the rules for literals apply (i.e., two occurrences of the empty

`

``

147

`+

immutable, the same rules as for literals apply (i.e., two occurrences of the empty

`

148

148

`tuple may or may not yield the same object).

`

149

149

``

150

150

`.. index::

`

`` @@ -484,8 +484,8 @@ will raise :exc:AttributeError or :exc:TypeError, while

``

484

484

`` When the underlying iterator is complete, the :attr:~StopIteration.value

``

485

485

`` attribute of the raised :exc:StopIteration instance becomes the value of

``

486

486

`the yield expression. It can be either set explicitly when raising

`

487

``

`` -

:exc:StopIteration, or automatically when the sub-iterator is a generator

``

488

``

`-

(by returning a value from the sub-generator).

`

``

487

`` +

:exc:StopIteration, or automatically when the subiterator is a generator

``

``

488

`+

(by returning a value from the subgenerator).

`

489

489

``

490

490

` .. versionchanged:: 3.3

`

491

491

``` Added yield from <expr> to delegate control flow to a subiterator.


`@@ -504,7 +504,7 @@ on the right hand side of an assignment statement.

`

`504`

`504`

``

`505`

`505`

`` :pep:`380` - Syntax for Delegating to a Subgenerator

``

`506`

`506`

``  The proposal to introduce the :token:`yield_from` syntax, making delegation

``

`507`

``

`-

to sub-generators easy.

`

``

`507`

`+

to subgenerators easy.

`

`508`

`508`

``

`509`

`509`

`` :pep:`525` - Asynchronous Generators

``

`510`

`510`

``  The proposal that expanded on :pep:`492` by adding generator capabilities to

``

`@@ -613,7 +613,7 @@ Asynchronous generator functions

`

`613`

`613`

`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`

`614`

`614`

``

`615`

`615`

`The presence of a yield expression in a function or method defined using

`

`616`

``

`` -

:keyword:`async def` further defines the function as a

``

``

`616`

`` +

:keyword:`async def` further defines the function as an

``

`617`

`617`

`` :term:`asynchronous generator` function.

``

`618`

`618`

``

`619`

`619`

`When an asynchronous generator function is called, it returns an

`

`@@ -678,13 +678,13 @@ which are used to control the execution of a generator function.

`

`678`

`678`

``

`679`

`679`

` Returns an awaitable which when run starts to execute the asynchronous

`

`680`

`680`

` generator or resumes it at the last executed yield expression. When an

`

`681`

``

`` -

asynchronous generator function is resumed with a :meth:`~agen.__anext__`

``

``

`681`

`` +

asynchronous generator function is resumed with an :meth:`~agen.__anext__`

``

`682`

`682`

``  method, the current yield expression always evaluates to :const:`None` in

``

`683`

`683`

` the returned awaitable, which when run will continue to the next yield

`

`684`

`684`

``  expression. The value of the :token:`expression_list` of the yield

``

`685`

`685`

``  expression is the value of the :exc:`StopIteration` exception raised by

``

`686`

`686`

` the completing coroutine. If the asynchronous generator exits without

`

`687`

``

`-

yielding another value, the awaitable instead raises an

`

``

`687`

`+

yielding another value, the awaitable instead raises a

`

`688`

`688`

`` :exc:`StopAsyncIteration` exception, signalling that the asynchronous

``

`689`

`689`

` iteration has completed.

`

`690`

`690`

``

`@@ -712,7 +712,7 @@ which are used to control the execution of a generator function.

`

`712`

`712`

` where the asynchronous generator was paused, and returns the next value

`

`713`

`713`

` yielded by the generator function as the value of the raised

`

`714`

`714`

`` :exc:`StopIteration` exception. If the asynchronous generator exits

``

`715`

``

`` -

without yielding another value, an :exc:`StopAsyncIteration` exception is

``

``

`715`

`` +

without yielding another value, a :exc:`StopAsyncIteration` exception is

``

`716`

`716`

` raised by the awaitable.

`

`717`

`717`

` If the generator function does not catch the passed-in exception, or

`

`718`

`718`

` raises a different exception, then when the awaitable is run that exception

`

`` @@ -1584,7 +1584,7 @@ if :keyword:`in` raised that exception).

``

`1584`

`1584`

` pair: membership; test

`

`1585`

`1585`

` object: sequence

`

`1586`

`1586`

``

`1587`

``

`` -

The operator :keyword:`not in` is defined to have the inverse true value of

``

``

`1587`

`` +

The operator :keyword:`not in` is defined to have the inverse truth value of

``

`1588`

`1588`

`` :keyword:`in`.

``

`1589`

`1589`

``

`1590`

`1590`

`.. index::

`

`` @@ -1599,8 +1599,8 @@ The operator :keyword:`not in` is defined to have the inverse true value of

``

`1599`

`1599`

`Identity comparisons

`

`1600`

`1600`

`--------------------

`

`1601`

`1601`

``

`1602`

``

``` -

The operators :keyword:`is` and :keyword:`is not` test for object identity: ``x

1603

``


is y`` is true if and only if *x* and *y* are the same object. Object identity

``

1602


The operators :keyword:`is` and :keyword:`is not` test for an object's identity: ``x

``

1603


is y`` is true if and only if *x* and *y* are the same object. An Object's identity

1604

1604

``` is determined using the :meth:id function. x is not y yields the inverse

```

1605

1605

`truth value. [#]_

`

1606

1606

``