Skip to content

Commit

Permalink
Update context_managers.rst
Browse files Browse the repository at this point in the history
Grammatical errors: lines 103, 104, 107, 159, 161.
  • Loading branch information
bbishop423 committed Mar 22, 2016
1 parent 0e65b48 commit 3272fe8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions context_managers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ an error is encountered.
2. It allows the ``__exit__`` method to handle the exception.
3. If ``__exit__`` returns True then the exception was gracefully
handled.
4. If anything else than True is returned by ``__exit__`` method then
the exception is raised by ``with`` statement.
4. If anything else than True is returned by the ``__exit__`` method then
an exception is raised by the ``with`` statement.

In our case the ``__exit__`` method returns ``None`` (when no return
statement is encountered then the method returns ``None``). Therefore,
statement is encountered then the method returns ``None``). Therefore, the
``with`` statement raises the exception.

.. code:: python
Expand Down Expand Up @@ -156,9 +156,9 @@ Let's see a basic, useless example:
yield f
f.close()
Okay! This way of implementing Context Managers appear to be more
Okay! This way of implementing Context Managers appears to be more
intuitive and easy. However, this method requires some knowledge about
generators, yield and decorators. In this example we have not caught any
generators, yield, and decorators. In this example we have not caught any
exceptions which might occur. It works in mostly the same way as the
previous method.

Expand Down

0 comments on commit 3272fe8

Please sign in to comment.