diff --git a/README.md b/README.md index b3b1059..3ce5a31 100644 --- a/README.md +++ b/README.md @@ -1392,6 +1392,7 @@ finally: ``` * **Code inside the `'else'` block will only be executed if `'try'` block had no exceptions.** * **Code inside the `'finally'` block will always be executed (unless a signal is received).** +* **All variables that are initialized in executed blocks are also visible in all subsequent blocks, as well as outside the try/except clause (only function blocks delimit scope).** ### Catching Exceptions ```python @@ -1414,7 +1415,7 @@ raise ( [, ...]) #### Re-raising caught exception: ```python -except as : +except [as ]: ... raise ``` @@ -1426,7 +1427,7 @@ exc_type = .__class__ filename = .__traceback__.tb_frame.f_code.co_filename func_name = .__traceback__.tb_frame.f_code.co_name line = linecache.getline(filename, .__traceback__.tb_lineno) -traceback = ''.join(traceback.format_tb(.__traceback__)) +trace_str = ''.join(traceback.format_tb(.__traceback__)) error_msg = ''.join(traceback.format_exception(exc_type, , .__traceback__)) ``` diff --git a/index.html b/index.html index 33b392a..8e58050 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1194,6 +1194,7 @@ LogicOp = Enum('LogicOp', {'else' block will only be executed if 'try' block had no exceptions.
  • Code inside the 'finally' block will always be executed (unless a signal is received).
  • +
  • All variables that are initialized in executed blocks are also visible in all subsequent blocks, as well as outside the try/except clause (only function blocks delimit scope).
  • Catching Exceptions

    except <exception>: ...
     except <exception> as <name>: ...
    @@ -1212,7 +1213,7 @@ LogicOp = Enum('LogicOp', {raise <exception>(<el> [, ...])
     
    -

    Re-raising caught exception:

    except <exception> as <name>:
    +

    Re-raising caught exception:

    except <exception> [as <name>]:
         ...
         raise
     
    @@ -1222,7 +1223,7 @@ exc_type = <name>.__class__ filename = <name>.__traceback__.tb_frame.f_code.co_filename func_name = <name>.__traceback__.tb_frame.f_code.co_name line = linecache.getline(filename, <name>.__traceback__.tb_lineno) -traceback = ''.join(traceback.format_tb(<name>.__traceback__)) +trace_str = ''.join(traceback.format_tb(<name>.__traceback__)) error_msg = ''.join(traceback.format_exception(exc_type, <name>, <name>.__traceback__))
    @@ -2908,7 +2909,7 @@ $ pyinstaller script.py --add-data '<path>:.'