diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2013-01-22 09:35:23 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2013-01-22 09:35:23 +0100 |
| commit | 2d5f31d58fae5b95b8c981dbd9f6431fe668baf8 (patch) | |
| tree | 8733ec86c26f062d9c4cab3c78636074b2c26e53 | |
| parent | 1becaeb5a85b2d173d4e57f7ba687121da683231 (diff) | |
| download | blog-2d5f31d58fae5b95b8c981dbd9f6431fe668baf8.tar.gz | |
More typo fixes
| -rw-r--r-- | content/python-best-practices.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/content/python-best-practices.rst b/content/python-best-practices.rst index 68664db..167f5ab 100644 --- a/content/python-best-practices.rst +++ b/content/python-best-practices.rst @@ -215,7 +215,7 @@ programming style by handling errors *as they appear* instead of making test In Python, every time you are trying to execute an illegal operation (*e. g.* trying to access an element outside a list's boundaries, dividing by zero, etc.) instead of simply crashing the program, Python raises an exception which -can be caught, givng the programmer a last chance to fix the problem before the +can be caught, giving the programmer a last chance to fix the problem before the program ultimately crashes. The syntax to catch exceptions in Python is the following: @@ -230,7 +230,7 @@ The syntax to catch exceptions in Python is the following: For example, if a line of code contains a division by a number which could seldom be equal to zero, instead of systematically checking that the number is non zero, it is much more efficient to encapsulate the line within a ``try -... except ZeroDivisionErro:`` to handle specifically the rare cases when the +... except ZeroDivisionError:`` to handle specifically the rare cases when the number will be zero. This is the well-known principle: *better ask for absolution than permission*. @@ -397,7 +397,7 @@ For example, let us define the following function: When called, this function will produce an iterable object. When iterating over this object, at each iteration, one line of ``filename`` will be read, -and the minimum and maximum value of this line will be returned when the +and the minimum and maximum values of this line will be returned when the ``yield`` keyword is reached, freezing the execution of the function until the next iteration. |
