File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,11 @@ an error is encountered.
100
100
2. It allows the ``__exit__ `` method to handle the exception.
101
101
3. If ``__exit__ `` returns True then the exception was gracefully
102
102
handled.
103
- 4. If anything else than True is returned by ``__exit__ `` method then
104
- the exception is raised by ``with `` statement.
103
+ 4. If anything else than True is returned by the ``__exit__ `` method then
104
+ an exception is raised by the ``with `` statement.
105
105
106
106
In our case the ``__exit__ `` method returns ``None `` (when no return
107
- statement is encountered then the method returns ``None ``). Therefore,
107
+ statement is encountered then the method returns ``None ``). Therefore, the
108
108
``with `` statement raises the exception.
109
109
110
110
.. code :: python
@@ -156,9 +156,9 @@ Let's see a basic, useless example:
156
156
yield f
157
157
f.close()
158
158
159
- Okay! This way of implementing Context Managers appear to be more
159
+ Okay! This way of implementing Context Managers appears to be more
160
160
intuitive and easy. However, this method requires some knowledge about
161
- generators, yield and decorators. In this example we have not caught any
161
+ generators, yield, and decorators. In this example we have not caught any
162
162
exceptions which might occur. It works in mostly the same way as the
163
163
previous method.
164
164
You can’t perform that action at this time.
0 commit comments