From 2d5f31d58fae5b95b8c981dbd9f6431fe668baf8 Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Tue, 22 Jan 2013 09:35:23 +0100 Subject: More typo fixes --- content/python-best-practices.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'content') 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. -- cgit v1.2.3-70-g09d2