| OLD | NEW |
| 1 .. _compound: | 1 .. _compound: |
| 2 | 2 |
| 3 ******************* | 3 ******************* |
| 4 Compound statements | 4 Compound statements |
| 5 ******************* | 5 ******************* |
| 6 | 6 |
| 7 .. index:: pair: compound; statement | 7 .. index:: pair: compound; statement |
| 8 | 8 |
| 9 Compound statements contain (groups of) other statements; they affect or control | 9 Compound statements contain (groups of) other statements; they affect or control |
| 10 the execution of those other statements in some way. In general, compound | 10 the execution of those other statements in some way. In general, compound |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 The :keyword:`with` statement guarantees that if the :meth:`__enter__` | 365 The :keyword:`with` statement guarantees that if the :meth:`__enter__` |
| 366 method returns without an error, then :meth:`__exit__` will always be | 366 method returns without an error, then :meth:`__exit__` will always be |
| 367 called. Thus, if an error occurs during the assignment to the target list, | 367 called. Thus, if an error occurs during the assignment to the target list, |
| 368 it will be treated the same as an error occurring within the suite would | 368 it will be treated the same as an error occurring within the suite would |
| 369 be. See step 6 below. | 369 be. See step 6 below. |
| 370 | 370 |
| 371 #. The suite is executed. | 371 #. The suite is executed. |
| 372 | 372 |
| 373 #. The context manager's :meth:`__exit__` method is invoked. If an exception | 373 #. The context manager's :meth:`__exit__` method is invoked. If an exception |
| 374 caused the suite to be exited, its type, value, and traceback are passed as | 374 caused the suite to be exited, its type, value, and traceback are passed as |
| 375 arguments to :meth:`__exit__`. Otherwise, three :const:`None` arguments are | 375 arguments to :meth:`__exit__`. Otherwise, three ``None`` arguments are |
| 376 supplied. | 376 supplied. |
| 377 | 377 |
| 378 If the suite was exited due to an exception, and the return value from the | 378 If the suite was exited due to an exception, and the return value from the |
| 379 :meth:`__exit__` method was false, the exception is reraised. If the return | 379 :meth:`__exit__` method was false, the exception is reraised. If the return |
| 380 value was true, the exception is suppressed, and execution continues with the | 380 value was true, the exception is suppressed, and execution continues with the |
| 381 statement following the :keyword:`with` statement. | 381 statement following the :keyword:`with` statement. |
| 382 | 382 |
| 383 If the suite was exited for any reason other than an exception, the return | 383 If the suite was exited for any reason other than an exception, the return |
| 384 value from :meth:`__exit__` is ignored, and execution proceeds at the normal | 384 value from :meth:`__exit__` is ignored, and execution proceeds at the normal |
| 385 location for the kind of exit that was taken. | 385 location for the kind of exit that was taken. |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 or the execution of a :keyword:`return`, :keyword:`continue`, or | 629 or the execution of a :keyword:`return`, :keyword:`continue`, or |
| 630 :keyword:`break` statement. | 630 :keyword:`break` statement. |
| 631 | 631 |
| 632 .. [#] A string literal appearing as the first statement in the function body is | 632 .. [#] A string literal appearing as the first statement in the function body is |
| 633 transformed into the function's ``__doc__`` attribute and therefore the | 633 transformed into the function's ``__doc__`` attribute and therefore the |
| 634 function's :term:`docstring`. | 634 function's :term:`docstring`. |
| 635 | 635 |
| 636 .. [#] A string literal appearing as the first statement in the class body is | 636 .. [#] A string literal appearing as the first statement in the class body is |
| 637 transformed into the namespace's ``__doc__`` item and therefore the class's | 637 transformed into the namespace's ``__doc__`` item and therefore the class's |
| 638 :term:`docstring`. | 638 :term:`docstring`. |
| OLD | NEW |