From 2f5aee2cca53ac3f16db2398173158f99ce57c5c Mon Sep 17 00:00:00 2001 From: Vipul Kumar Date: Thu, 26 Aug 2021 07:52:46 +0530 Subject: [PATCH 1/4] [exceptions] Use gender neutral pronouns --- docs/exceptions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/exceptions.rst b/docs/exceptions.rst index 228f927..4ba719d 100644 --- a/docs/exceptions.rst +++ b/docs/exceptions.rst @@ -15,7 +15,7 @@ NameError ========== When one starts writing code, this will be one of the most common exception -he/she will find. This happens when someone tries to access a variable which is +they will find. This happens when someone tries to access a variable which is not defined. :: From 561374023048be4a09b9905a09bdb74791bcce44 Mon Sep 17 00:00:00 2001 From: Vipul Kumar Date: Thu, 26 Aug 2021 18:36:49 +0530 Subject: [PATCH 2/4] [exceptions] Improve wording of steps of exception handling This commit contains following changes: - Add "execute" verb in first bullet, sentence is missing a verb. - Swap second and third bullets. - Improve wording of third bullet by adding a statement about "try clause statement skipped, if exception occurred". --- docs/exceptions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/exceptions.rst b/docs/exceptions.rst index 4ba719d..3dbfb91 100644 --- a/docs/exceptions.rst +++ b/docs/exceptions.rst @@ -58,9 +58,9 @@ We use `try...except` blocks to handle any exception. The basic syntax looks lik It works in the following way: - - First all lines between `try` and `except` statements. - - If `ExceptionName` happens during execution of the statements then `except` clause statements execute - - If no exception happens then the statements inside `except` clause does not execute. + - First execute statement(s) between `try` and `except` keywords. + - If no exception happens then the statement(s) inside `except` clause does not execute. + - If an exception type, `ExceptionName` happens during execution of the statement(s) then rest of the `try` clause statement(s) skipped and `except` clause statement(s) get executed. - If the `Exception` is not handled in the `except` block then it goes out of `try` block. The following examples showcase these scenarios. From bcd0f2f315d84d7e5507d7a6dc513b6db04b2dfe Mon Sep 17 00:00:00 2001 From: Vipul Kumar Date: Fri, 27 Aug 2021 20:33:22 +0530 Subject: [PATCH 3/4] [exceptions] Improve wording of finally section Replacing "before finishing `try` statements" with "just before finishing exception handling", adds some more clarification about when `finally` block gets executed. --- docs/exceptions.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/exceptions.rst b/docs/exceptions.rst index 3dbfb91..93bd178 100644 --- a/docs/exceptions.rst +++ b/docs/exceptions.rst @@ -131,8 +131,7 @@ Using finally for cleanup ========================== If we want to have some statements which must be executed under all circumstances, -we can use `finally` clause, it will be always executed before finishing `try` -statements. +we can use `finally` clause, it will be always executed just before finishing exception handling. :: >>> try: From 43e84fea4d3ecfe112ee09c42912ef4d754cb583 Mon Sep 17 00:00:00 2001 From: Vipul Kumar Date: Thu, 26 Aug 2021 22:52:03 +0530 Subject: [PATCH 4/4] [exceptions] Fix punctuation End sentence with a colon punctuation, if next sentences contains explanation of it. --- docs/exceptions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/exceptions.rst b/docs/exceptions.rst index 93bd178..2dbcb09 100644 --- a/docs/exceptions.rst +++ b/docs/exceptions.rst @@ -45,7 +45,7 @@ is to do addition of Integers and a string. How to handle exceptions? ========================= -We use `try...except` blocks to handle any exception. The basic syntax looks like +We use `try...except` blocks to handle any exception. The basic syntax looks like: :: try: